mirror of
https://github.com/misskey-dev/misskey
synced 2024-12-30 06:28:31 +09:00
22 lines
524 B
TypeScript
22 lines
524 B
TypeScript
import * as mongo from 'mongodb';
|
|
|
|
function toString(id: any) {
|
|
return mongo.ObjectID.prototype.isPrototypeOf(id) ? (id as mongo.ObjectID).toHexString() : id;
|
|
}
|
|
|
|
export default function(note: any, mutedUserIds: string[]): boolean {
|
|
if (mutedUserIds.includes(toString(note.userId))) {
|
|
return true;
|
|
}
|
|
|
|
if (note.reply != null && mutedUserIds.includes(toString(note.reply.userId))) {
|
|
return true;
|
|
}
|
|
|
|
if (note.renote != null && mutedUserIds.includes(toString(note.renote.userId))) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|