Fix reported statuses not showing up

Fixes https://gitlab.com/soapbox-pub/soapbox/-/issues/1494
This commit is contained in:
Alex Gleason 2023-07-30 18:37:48 -05:00
parent 40fde3fc2c
commit ef42144896
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
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;