0
0
Fork 0

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

This commit is contained in:
Claire 2024-07-31 12:50:13 +02:00 committed by GitHub
parent 288961bbb9
commit 549ab089ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 70 additions and 20 deletions

View file

@ -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':