Change grouped notifications API shape (take 2) (#31214)

This commit is contained in:
Claire authored and GitHub committed 2024-07-31 10:50:13 +00:00
1 parent 288961bbb9
commit 549ab089ee
9 files changed
+70 -20

No files matched your search

@@ -14,7 +14,7 @@ import type { ApiReportJSON } from 'mastodon/api_types/reports';
export const NOTIFICATIONS_GROUP_MAX_AVATARS = 8;
interface BaseNotificationGroup
extends Omit<BaseNotificationGroupJSON, 'sample_accounts'> {
extends Omit<BaseNotificationGroupJSON, 'sample_account_ids'> {
sampleAccountIds: string[];
}
@@ -115,8 +115,7 @@ function createAccountRelationshipSeveranceEventFromJSON(
export function createNotificationGroupFromJSON(
groupJson: ApiNotificationGroupJSON,
): NotificationGroup {
const { sample_accounts, ...group } = groupJson;
const sampleAccountIds = sample_accounts.map((account) => account.id);
const { sample_account_ids: sampleAccountIds, ...group } = groupJson;
switch (group.type) {
case 'favourite':