From 71d42f64dc840e744e757cb5edae32276d83a7f4 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 11 Nov 2018 21:17:51 +0900 Subject: [Client] Implement word mute Closes #1739 --- src/client/app/common/scripts/should-mute-note.ts | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/client/app/common/scripts/should-mute-note.ts (limited to 'src/client/app/common/scripts/should-mute-note.ts') diff --git a/src/client/app/common/scripts/should-mute-note.ts b/src/client/app/common/scripts/should-mute-note.ts new file mode 100644 index 0000000000..a849135763 --- /dev/null +++ b/src/client/app/common/scripts/should-mute-note.ts @@ -0,0 +1,28 @@ +export default function(me, settings, note) { + const isMyNote = note.userId == me.id; + const isPureRenote = note.renoteId != null && note.text == null && note.fileIds.length == 0 && note.poll == null; + + if (settings.showMyRenotes === false) { + if (isMyNote && isPureRenote) { + return true; + } + } + + if (settings.showRenotedMyNotes === false) { + if (isPureRenote && (note.renote.userId == me.id)) { + return true; + } + } + + if (settings.showLocalRenotes === false) { + if (isPureRenote && (note.renote.user.host == null)) { + return true; + } + } + + if (!isMyNote && note.text && settings.mutedWords.some(q => !q.some(word => !note.text.includes(word)))) { + return true; + } + + return false; +} -- cgit v1.2.3-freya