diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-09-17 23:07:15 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-09-17 23:07:15 +0900 |
| commit | 44f6fe6f1fa3873d6b6950dc5746725f014a1bb1 (patch) | |
| tree | 6e3593d17111e620312642dee58cb89db99e0040 /src/misc | |
| parent | No lint when test (diff) | |
| download | sharkey-44f6fe6f1fa3873d6b6950dc5746725f014a1bb1.tar.gz sharkey-44f6fe6f1fa3873d6b6950dc5746725f014a1bb1.tar.bz2 sharkey-44f6fe6f1fa3873d6b6950dc5746725f014a1bb1.zip | |
Refactor: Extract shouldMuteThisNote function
Diffstat (limited to 'src/misc')
| -rw-r--r-- | src/misc/should-mute-this-note.ts | 15 |
1 files changed, 15 insertions, 0 deletions
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; +} |