catstodon/app/javascript/flavours/glitch/actions/notifications_migration.tsx
Claire 435ff8e550 [Glitch] Add ability for admins to force grouped notifications in web UI
Port c73868cd78 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-08-27 20:33:50 +02:00

14 lines
538 B
TypeScript

import { selectUseGroupedNotifications } from 'flavours/glitch/selectors/settings';
import { createAppAsyncThunk } from 'flavours/glitch/store';
import { fetchNotifications } from './notification_groups';
import { expandNotifications } from './notifications';
export const initializeNotifications = createAppAsyncThunk(
'notifications/initialize',
(_, { dispatch, getState }) => {
if (selectUseGroupedNotifications(getState()))
void dispatch(fetchNotifications());
else void dispatch(expandNotifications({}));
},
);