Skip to content

Commit

Permalink
Fix #2738
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Sep 19, 2018
1 parent faf29b7 commit cd7f8b0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/misc/should-mute-this-note.ts
@@ -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;
}

Expand Down

0 comments on commit cd7f8b0

Please sign in to comment.