mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-14 00:08:46 +00:00
[Glitch] Fix all streamed notification types being stored without filtering
Port a7b718c31a to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -15,6 +15,7 @@ import type { NotificationGap } from 'flavours/glitch/reducers/notification_grou
|
||||
import {
|
||||
selectSettingsNotificationsExcludedTypes,
|
||||
selectSettingsNotificationsQuickFilterActive,
|
||||
selectSettingsNotificationsShows,
|
||||
} from 'flavours/glitch/selectors/settings';
|
||||
import type { AppDispatch } from 'flavours/glitch/store';
|
||||
import {
|
||||
@@ -104,7 +105,31 @@ export const fetchNotificationsGap = createDataLoadingThunk(
|
||||
|
||||
export const processNewNotificationForGroups = createAppAsyncThunk(
|
||||
'notificationGroups/processNew',
|
||||
(notification: ApiNotificationJSON, { dispatch }) => {
|
||||
(notification: ApiNotificationJSON, { dispatch, getState }) => {
|
||||
const state = getState();
|
||||
const activeFilter = selectSettingsNotificationsQuickFilterActive(state);
|
||||
const notificationShows = selectSettingsNotificationsShows(state);
|
||||
|
||||
const showInColumn =
|
||||
activeFilter === 'all'
|
||||
? notificationShows[notification.type]
|
||||
: activeFilter === notification.type;
|
||||
|
||||
if (!showInColumn) return;
|
||||
|
||||
if (
|
||||
(notification.type === 'mention' || notification.type === 'update') &&
|
||||
notification.status.filtered
|
||||
) {
|
||||
const filters = notification.status.filtered.filter((result) =>
|
||||
result.filter.context.includes('notifications'),
|
||||
);
|
||||
|
||||
if (filters.some((result) => result.filter.filter_action === 'hide')) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
dispatchAssociatedRecords(dispatch, [notification]);
|
||||
|
||||
return notification;
|
||||
|
||||
Reference in New Issue
Block a user