diff --git a/src/components/audit/AuditEntryInline.vue b/src/components/audit/AuditEntryInline.vue index df4c0f8..3a77d5d 100644 --- a/src/components/audit/AuditEntryInline.vue +++ b/src/components/audit/AuditEntryInline.vue @@ -39,7 +39,7 @@ diff --git a/src/i18n/locales/en-GB/audit.json b/src/i18n/locales/en-GB/audit.json index 8e6e94b..2e9615a 100644 --- a/src/i18n/locales/en-GB/audit.json +++ b/src/i18n/locales/en-GB/audit.json @@ -17,6 +17,9 @@ "message": "{author} has unlocked the deck door" } }, + "author": { + "unknown": "Someone" + }, "list": { "description": "Everything that happens in detail.", "empty": { diff --git a/src/i18n/locales/fr-FR/audit.json b/src/i18n/locales/fr-FR/audit.json index 609c54e..49d8670 100644 --- a/src/i18n/locales/fr-FR/audit.json +++ b/src/i18n/locales/fr-FR/audit.json @@ -17,6 +17,9 @@ "message": "{author} a déverrouillé la porte de la terrasse" } }, + "author": { + "unknown": "Quelqu'un" + }, "list": { "description": "Tout ce qui se passe en détail.", "empty": { diff --git a/src/services/api/audit.ts b/src/services/api/audit.ts index 0ae5fd8..4380aab 100644 --- a/src/services/api/audit.ts +++ b/src/services/api/audit.ts @@ -10,7 +10,7 @@ export enum AuditAction { export interface AuditEvent { _id: string; - author: { + author?: { _id?: string; wpUserId: number; name: string; diff --git a/src/views/Private/History/HistoryEventsList.vue b/src/views/Private/History/HistoryEventsList.vue index 0a7e19d..312df14 100644 --- a/src/views/Private/History/HistoryEventsList.vue +++ b/src/views/Private/History/HistoryEventsList.vue @@ -185,7 +185,8 @@ interface ListSorter { const ALL_LIST_SORTERS = computed(() => [ { key: 'occurred', - sort: (a, b) => new Date(b.occurred).getTime() - new Date(a.occurred).getTime(), + sort: (a: AuditEvent, b: AuditEvent) => + new Date(b.occurred).getTime() - new Date(a.occurred).getTime(), }, { key: 'action', @@ -194,7 +195,9 @@ const ALL_LIST_SORTERS = computed(() => [ { key: 'author', sort: (a, b) => - a.author.name.toLocaleLowerCase().localeCompare(b.author.name.toLocaleLowerCase()), + (a.author?.name.toLocaleLowerCase() || '').localeCompare( + b.author?.name.toLocaleLowerCase() || '', + ), }, ]);