diff --git a/app/soapbox/reducers/admin.ts b/app/soapbox/reducers/admin.ts index bf2fd0818d..b8b11cd177 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 343b1103b0..b450a15d87 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;