From c08d13a65cc0434bb3c9d1c0e9ff03640cf77526 Mon Sep 17 00:00:00 2001 From: diondiondion Date: Fri, 5 Jun 2026 12:01:55 +0200 Subject: [PATCH] Fix missing null check when importing collections from notifications (#39300) --- app/javascript/mastodon/actions/notification_groups.ts | 2 +- app/javascript/mastodon/api_types/notifications.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/javascript/mastodon/actions/notification_groups.ts b/app/javascript/mastodon/actions/notification_groups.ts index 6d2f00ece8..8fc2f0d726 100644 --- a/app/javascript/mastodon/actions/notification_groups.ts +++ b/app/javascript/mastodon/actions/notification_groups.ts @@ -88,7 +88,7 @@ function dispatchAssociatedRecords( fetchedStatuses.push(notification.status); } - if ('collection' in notification) { + if ('collection' in notification && notification.collection) { collections.push(notification.collection); } }); diff --git a/app/javascript/mastodon/api_types/notifications.ts b/app/javascript/mastodon/api_types/notifications.ts index 4836c37e6a..a06aab7884 100644 --- a/app/javascript/mastodon/api_types/notifications.ts +++ b/app/javascript/mastodon/api_types/notifications.ts @@ -90,22 +90,22 @@ interface ReportNotificationJSON extends BaseNotificationJSON { interface AddedToCollectionNotificationGroupJSON extends BaseNotificationGroupJSON { type: 'added_to_collection'; - collection: ApiCollectionJSON; + collection: ApiCollectionJSON | null; } interface AddedToCollectionNotificationJSON extends BaseNotificationJSON { type: 'added_to_collection'; - collection: ApiCollectionJSON; + collection: ApiCollectionJSON | null; } interface CollectionUpdateNotificationGroupJSON extends BaseNotificationGroupJSON { type: 'collection_update'; - collection: ApiCollectionJSON; + collection: ApiCollectionJSON | null; } interface CollectionUpdateNotificationJSON extends BaseNotificationJSON { type: 'collection_update'; - collection: ApiCollectionJSON; + collection: ApiCollectionJSON | null; } type SimpleNotificationTypes = 'follow' | 'follow_request' | 'admin.sign_up';