Skip to content

Commit 5716ebf

Browse files
renchapClearlyClaire
authored andcommitted
[Glitch] Add notification grouping for follow notifications
Port d6f5ee7 to glitch-soc Signed-off-by: Claire <[email protected]>
1 parent 36ce581 commit 5716ebf

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

app/javascript/flavours/glitch/actions/notification_groups.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,15 @@ function dispatchAssociatedRecords(
6868
dispatch(importFetchedStatuses(fetchedStatuses));
6969
}
7070

71+
const supportedGroupedNotificationTypes = ['favourite', 'reblog'];
72+
7173
export const fetchNotifications = createDataLoadingThunk(
7274
'notificationGroups/fetch',
7375
async (_params, { getState }) =>
74-
apiFetchNotificationGroups({ exclude_types: getExcludedTypes(getState()) }),
76+
apiFetchNotificationGroups({
77+
grouped_types: supportedGroupedNotificationTypes,
78+
exclude_types: getExcludedTypes(getState()),
79+
}),
7580
({ notifications, accounts, statuses }, { dispatch }) => {
7681
dispatch(importFetchedAccounts(accounts));
7782
dispatch(importFetchedStatuses(statuses));
@@ -93,6 +98,7 @@ export const fetchNotificationsGap = createDataLoadingThunk(
9398
'notificationGroups/fetchGap',
9499
async (params: { gap: NotificationGap }, { getState }) =>
95100
apiFetchNotificationGroups({
101+
grouped_types: supportedGroupedNotificationTypes,
96102
max_id: params.gap.maxId,
97103
exclude_types: getExcludedTypes(getState()),
98104
}),
@@ -109,6 +115,7 @@ export const pollRecentNotifications = createDataLoadingThunk(
109115
'notificationGroups/pollRecentNotifications',
110116
async (_params, { getState }) => {
111117
return apiFetchNotificationGroups({
118+
grouped_types: supportedGroupedNotificationTypes,
112119
max_id: undefined,
113120
exclude_types: getExcludedTypes(getState()),
114121
// In slow mode, we don't want to include notifications that duplicate the already-displayed ones

app/javascript/flavours/glitch/api/notifications.ts

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const apiFetchNotifications = async (
3131

3232
export const apiFetchNotificationGroups = async (params?: {
3333
url?: string;
34+
grouped_types?: string[];
3435
exclude_types?: string[];
3536
max_id?: string;
3637
since_id?: string;

0 commit comments

Comments
 (0)