mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-22 16:28:08 +01:00
Fix unsupported grouped notifications from streaming causing duplicate IDs (#32243)
This commit is contained in:
parent
81cd489208
commit
6d5aa58f88
1 changed files with 45 additions and 42 deletions
|
@ -206,7 +206,13 @@ function processNewNotification(
|
||||||
groups: NotificationGroupsState['groups'],
|
groups: NotificationGroupsState['groups'],
|
||||||
notification: ApiNotificationJSON,
|
notification: ApiNotificationJSON,
|
||||||
) {
|
) {
|
||||||
if (shouldGroupNotificationType(notification.type)) {
|
if (!shouldGroupNotificationType(notification.type)) {
|
||||||
|
notification = {
|
||||||
|
...notification,
|
||||||
|
group_key: `ungrouped-${notification.id}`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const existingGroupIndex = groups.findIndex(
|
const existingGroupIndex = groups.findIndex(
|
||||||
(group) =>
|
(group) =>
|
||||||
group.type !== 'gap' && group.group_key === notification.group_key,
|
group.type !== 'gap' && group.group_key === notification.group_key,
|
||||||
|
@ -242,15 +248,12 @@ function processNewNotification(
|
||||||
mergeGapsAround(groups, existingGroupIndex);
|
mergeGapsAround(groups, existingGroupIndex);
|
||||||
|
|
||||||
groups.unshift(existingGroup);
|
groups.unshift(existingGroup);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
// We have not found an existing group, create a new one
|
// We have not found an existing group, create a new one
|
||||||
groups.unshift(createNotificationGroupFromNotificationJSON(notification));
|
groups.unshift(createNotificationGroupFromNotificationJSON(notification));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function trimNotifications(state: NotificationGroupsState) {
|
function trimNotifications(state: NotificationGroupsState) {
|
||||||
if (state.scrolledToTop && state.groups.length > NOTIFICATIONS_TRIM_LIMIT) {
|
if (state.scrolledToTop && state.groups.length > NOTIFICATIONS_TRIM_LIMIT) {
|
||||||
|
|
Loading…
Reference in a new issue