mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-24 18:13:09 +02:00
Fix #2738
This commit is contained in:
parent
faf29b768f
commit
cd7f8b080e
1 changed files with 9 additions and 3 deletions
|
@ -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 {
|
export default function(note: any, mutedUserIds: string[]): boolean {
|
||||||
if (mutedUserIds.indexOf(note.userId) != -1) {
|
if (mutedUserIds.includes(toString(note.userId))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note.reply != null && mutedUserIds.indexOf(note.reply.userId) != -1) {
|
if (note.reply != null && mutedUserIds.includes(toString(note.reply.userId))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note.renote != null && mutedUserIds.indexOf(note.renote.userId) != -1) {
|
if (note.renote != null && mutedUserIds.includes(toString(note.renote.userId))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue