From 44f6fe6f1fa3873d6b6950dc5746725f014a1bb1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 17 Sep 2018 23:07:15 +0900 Subject: Refactor: Extract shouldMuteThisNote function --- src/misc/should-mute-this-note.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/misc/should-mute-this-note.ts (limited to 'src/misc') diff --git a/src/misc/should-mute-this-note.ts b/src/misc/should-mute-this-note.ts new file mode 100644 index 0000000000..c818115a3c --- /dev/null +++ b/src/misc/should-mute-this-note.ts @@ -0,0 +1,15 @@ +export default function(note: any, mutedUserIds: string[]): boolean { + if (mutedUserIds.indexOf(note.userId) != -1) { + return true; + } + + if (note.reply != null && mutedUserIds.indexOf(note.reply.userId) != -1) { + return true; + } + + if (note.renote != null && mutedUserIds.indexOf(note.renote.userId) != -1) { + return true; + } + + return false; +} -- cgit v1.2.3-freya