From c0fa0095c03d88b1b5532ac6550d71349b78a5aa Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Wed, 18 Jan 2023 22:20:37 +0200 Subject: [PATCH] RED-5910: show delta changes for suggestions --- .../file-preview/services/file-data.service.ts | 15 ++++++++------- .../src/lib/redaction-log/manual-change.ts | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts b/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts index 4ffda0c28..4f803c7e3 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts @@ -306,15 +306,16 @@ export class FileDataService extends EntitiesService change.processed && change.annotationStatus === LogEntryStatuses.APPROVED, - ); + const visibleStatuses: string[] = [LogEntryStatuses.APPROVED, LogEntryStatuses.REQUESTED]; + const viableManualChanges = redactionLogEntry.manualChanges.filter(change => visibleStatuses.includes(change.annotationStatus)); viableManualChanges.sort(chronologicallyBy(x => x.processedDate)); const lastManualChange = viableManualChanges.at(-1); - changeOccurredAfterPageIsViewed = lastManualChange && timestampOf(lastManualChange.processedDate) > viewTime; + const isSuggestion = lastManualChange?.annotationStatus === LogEntryStatuses.REQUESTED; + const processedTime = isSuggestion ? lastManualChange.requestedDate : lastManualChange?.processedDate; + changeOccurredAfterPageIsViewed = processedTime && timestampOf(processedTime) > viewTime; if (changeOccurredAfterPageIsViewed) { - this.#markPageAsUnseenIfNeeded(viewedPage, lastManualChange.processedDate); + this.#markPageAsUnseenIfNeeded(viewedPage, processedTime); return { changeLogType: ChangeTypes.CHANGED, hidden: false, @@ -328,8 +329,8 @@ export class FileDataService extends EntitiesService