mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-12-02 06:37:57 -07:00
22 lines
536 B
TypeScript
22 lines
536 B
TypeScript
import * as mongo from 'mongodb';
|
|
import isObjectId from './is-objectid';
|
|
|
|
function toString(id: any) {
|
|
return isObjectId(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;
|
|
}
|