From ef42144896bdaf9fecb3f1d3a7cf2e72dff64f3c Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 30 Jul 2023 18:37:48 -0500 Subject: [PATCH] Fix reported statuses not showing up Fixes https://gitlab.com/soapbox-pub/soapbox/-/issues/1494 --- app/soapbox/reducers/admin.ts | 3 +-- app/soapbox/utils/normalizers.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/soapbox/reducers/admin.ts b/app/soapbox/reducers/admin.ts index bf2fd0818..b8b11cd17 100644 --- a/app/soapbox/reducers/admin.ts +++ b/app/soapbox/reducers/admin.ts @@ -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; }; diff --git a/app/soapbox/utils/normalizers.ts b/app/soapbox/utils/normalizers.ts index 343b1103b..b450a15d8 100644 --- a/app/soapbox/utils/normalizers.ts +++ b/app/soapbox/utils/normalizers.ts @@ -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 = (value: V) => R;