From 3771a993b7e19bc0e756e7f727f10ddd14c10c93 Mon Sep 17 00:00:00 2001 From: ThibG Date: Tue, 18 Jun 2019 18:23:08 +0200 Subject: [PATCH] =?UTF-8?q?[Glitch]=20Completely=20hide=20toots=20matched?= =?UTF-8?q?=20by=20=E2=80=9Cirreversible=E2=80=9D=20filters=20even=20if=20?= =?UTF-8?q?they=20got=20to=20the=20client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/flavours/glitch/actions/notifications.js | 5 +++++ app/javascript/flavours/glitch/selectors/index.js | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/app/javascript/flavours/glitch/actions/notifications.js b/app/javascript/flavours/glitch/actions/notifications.js index 57fecf63d4d..2107503db4f 100644 --- a/app/javascript/flavours/glitch/actions/notifications.js +++ b/app/javascript/flavours/glitch/actions/notifications.js @@ -62,9 +62,14 @@ export function updateNotifications(notification, intlMessages, intlLocale) { let filtered = false; if (notification.type === 'mention') { + const dropRegex = regexFromFilters(filters.filter(filter => filter.get('irreversible'))); const regex = regexFromFilters(filters); const searchIndex = notification.status.spoiler_text + '\n' + unescapeHTML(notification.status.content); + if (dropRegex && dropRegex.test(searchIndex)) { + return; + } + filtered = regex && regex.test(searchIndex); } diff --git a/app/javascript/flavours/glitch/selectors/index.js b/app/javascript/flavours/glitch/selectors/index.js index d1a88a2fc98..2d4f3f7b4ec 100644 --- a/app/javascript/flavours/glitch/selectors/index.js +++ b/app/javascript/flavours/glitch/selectors/index.js @@ -78,6 +78,12 @@ export const makeGetStatus = () => { return null; } + const dropRegex = (accountReblog || accountBase).get('id') !== me && regexFromFilters(filters.filter(filter => filter.get('irreversible'))); + + if (dropRegex && dropRegex.test(statusBase.get('reblog') ? statusReblog.get('search_index') : statusBase.get('search_index'))) { + return null; + } + const regex = (accountReblog || accountBase).get('id') !== me && regexFromFilters(filters); let filtered = false;