about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-05-07 04:50:40 +0200
committerGitHub <noreply@github.com>2022-05-07 04:50:40 +0200
commitf17e73da09e6c63665aee4e9731df7808094960e (patch)
treee345738334bd22a13f8f935a0c89676384243f3c
parent991353682d96cecd4695e150cb6030613d447844 (diff)
Fix streaming notifications not using quick filter logic (#18316)
Fixes #18309

The quickFilter logic was used on display and to request new notification
pages, but not for live updates. The main issue this caused is bump the unread
notifications count regardless of the quickFilter setting.

Since notifications are re-fetched when changing quickFilter settings, it is
safe to drop live notifications that do not match the selected filter.
-rw-r--r--app/javascript/mastodon/actions/notifications.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/javascript/mastodon/actions/notifications.js b/app/javascript/mastodon/actions/notifications.js
index 00e8d74d7..96cf628d6 100644
--- a/app/javascript/mastodon/actions/notifications.js
+++ b/app/javascript/mastodon/actions/notifications.js
@@ -58,7 +58,8 @@ export const loadPending = () => ({
 
 export function updateNotifications(notification, intlMessages, intlLocale) {
   return (dispatch, getState) => {
-    const showInColumn = getState().getIn(['settings', 'notifications', 'shows', notification.type], true);
+    const activeFilter = getState().getIn(['settings', 'notifications', 'quickFilter', 'active']);
+    const showInColumn = activeFilter === 'all' ? getState().getIn(['settings', 'notifications', 'shows', notification.type], true) : activeFilter === notification.type;
     const showAlert    = getState().getIn(['settings', 'notifications', 'alerts', notification.type], true);
     const playSound    = getState().getIn(['settings', 'notifications', 'sounds', notification.type], true);
     const filters      = getFiltersRegex(getState(), { contextType: 'notifications' });