Merge branch 'fix-reports' into 'develop'

Fix reported statuses not showing up

Closes #1494

See merge request soapbox-pub/soapbox!2635
This commit is contained in:
Alex Gleason 2023-07-31 01:47:39 +00:00
commit 5a988cb528
2 changed files with 2 additions and 3 deletions

View file

@ -145,8 +145,7 @@ const minifyReport = (report: AdminReportRecord): ReducerAdminReport => {
target_account: normalizeId(report.getIn(['target_account', 'id'])),
action_taken_by_account: normalizeId(report.getIn(['action_taken_by_account', 'id'])),
assigned_account: normalizeId(report.getIn(['assigned_account', 'id'])),
statuses: report.get('statuses').map((status: any) => normalizeId(status.id)),
statuses: report.get('statuses').map((status: any) => normalizeId(status.get('id'))),
}) as ReducerAdminReport;
};

View file

@ -10,7 +10,7 @@ export const makeEmojiMap = (emojis: any) => emojis.reduce((obj: any, emoji: any
/** Normalize entity ID */
export const normalizeId = (id: any): string | null => {
return typeof id === 'string' ? id : null;
return z.string().nullable().catch(null).parse(id);
};
export type Normalizer<V, R> = (value: V) => R;