]> cat aescling's git repositories - mastodon.git/commitdiff
Fix streaming notifications not using quick filter logic (#18316)
authorClaire <claire.github-309c@sitedethib.com>
Sat, 7 May 2022 02:50:40 +0000 (04:50 +0200)
committersingle-right-quote <11325618-aescling@users.noreply.gitlab.com>
Fri, 27 May 2022 03:32:56 +0000 (23:32 -0400)
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.

app/javascript/mastodon/actions/notifications.js

index 00e8d74d7c51349e7311104f8d5daa7e1dc69fea..96cf628d693a47c3774a8f88dcb9352fa46066ec 100644 (file)
@@ -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' });