summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-09-20 04:56:24 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-09-20 04:56:24 +0900
commitcd7f8b080e50fa6f4ae094262d33cf7f750c4ea7 (patch)
tree012830a928b3d14e49614aba63a7ec6fe813875b /src
parentMake admin can delete any note (diff)
downloadsharkey-cd7f8b080e50fa6f4ae094262d33cf7f750c4ea7.tar.gz
sharkey-cd7f8b080e50fa6f4ae094262d33cf7f750c4ea7.tar.bz2
sharkey-cd7f8b080e50fa6f4ae094262d33cf7f750c4ea7.zip
Fix #2738
Diffstat (limited to 'src')
-rw-r--r--src/misc/should-mute-this-note.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/misc/should-mute-this-note.ts b/src/misc/should-mute-this-note.ts
index c818115a3c..663e60af6d 100644
--- a/src/misc/should-mute-this-note.ts
+++ b/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;
}