RED-5910: show delta changes for suggestions
This commit is contained in:
parent
4a9c633f1d
commit
c0fa0095c0
@ -306,15 +306,16 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
|
||||
};
|
||||
}
|
||||
|
||||
const viableManualChanges = redactionLogEntry.manualChanges.filter(
|
||||
change => 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<AnnotationWrapper, Annotati
|
||||
};
|
||||
}
|
||||
|
||||
#markPageAsUnseenIfNeeded(viewedPage: ViewedPage, dateTime: string) {
|
||||
const showAsUnseen = timestampOf(viewedPage.viewedTime) < timestampOf(dateTime);
|
||||
#markPageAsUnseenIfNeeded(viewedPage: ViewedPage, processedTime: string) {
|
||||
const showAsUnseen = timestampOf(viewedPage.viewedTime) < timestampOf(processedTime);
|
||||
if (showAsUnseen) {
|
||||
this._viewedPagesMapService.delete(this._state.fileId, viewedPage);
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import { LogEntryStatus, ManualRedactionType } from './types';
|
||||
export interface IManualChange {
|
||||
userId: string;
|
||||
processedDate: string;
|
||||
requestedDate: string;
|
||||
annotationStatus: LogEntryStatus;
|
||||
manualRedactionType: ManualRedactionType;
|
||||
propertyChanges: { [key: string]: any };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user