This commit is contained in:
syuilo 2018-09-20 04:56:24 +09:00
parent faf29b768f
commit cd7f8b080e
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69

View File

@ -1,13 +1,19 @@
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.indexOf(note.userId) != -1) {
if (mutedUserIds.includes(toString(note.userId))) {
return true;
}
if (note.reply != null && mutedUserIds.indexOf(note.reply.userId) != -1) {
if (note.reply != null && mutedUserIds.includes(toString(note.reply.userId))) {
return true;
}
if (note.renote != null && mutedUserIds.indexOf(note.renote.userId) != -1) {
if (note.renote != null && mutedUserIds.includes(toString(note.renote.userId))) {
return true;
}