mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-18 04:19:27 +00:00
Fix unsupported grouped notifications from streaming causing duplicate IDs (#32243)
This commit is contained in:
parent
463f9197d8
commit
77f5b127fa
|
@ -206,7 +206,13 @@ function processNewNotification(
|
|||
groups: NotificationGroupsState['groups'],
|
||||
notification: ApiNotificationJSON,
|
||||
) {
|
||||
if (shouldGroupNotificationType(notification.type)) {
|
||||
if (!shouldGroupNotificationType(notification.type)) {
|
||||
notification = {
|
||||
...notification,
|
||||
group_key: `ungrouped-${notification.id}`,
|
||||
};
|
||||
}
|
||||
|
||||
const existingGroupIndex = groups.findIndex(
|
||||
(group) =>
|
||||
group.type !== 'gap' && group.group_key === notification.group_key,
|
||||
|
@ -242,14 +248,11 @@ function processNewNotification(
|
|||
mergeGapsAround(groups, existingGroupIndex);
|
||||
|
||||
groups.unshift(existingGroup);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// We have not found an existing group, create a new one
|
||||
groups.unshift(createNotificationGroupFromNotificationJSON(notification));
|
||||
}
|
||||
}
|
||||
|
||||
function trimNotifications(state: NotificationGroupsState) {
|
||||
|
|
Loading…
Reference in a new issue