RED-6466: mark annotation as redaction if re-created
This commit is contained in:
parent
02f4f33115
commit
7a1bab4c44
@ -4,6 +4,7 @@ import {
|
||||
annotationDefaultColorConfig,
|
||||
annotationEntityColorConfig,
|
||||
AnnotationIconType,
|
||||
ChangeTypes,
|
||||
DefaultColors,
|
||||
Dictionary,
|
||||
Earmark,
|
||||
@ -23,6 +24,7 @@ import {
|
||||
} from '@red/domain';
|
||||
import { RedactionLogEntry } from '@models/file/redaction-log.entry';
|
||||
import { IListable, List } from '@iqser/common-ui';
|
||||
import { chronologicallyBy, timestampOf } from '../../modules/file-preview/services/file-data.service';
|
||||
|
||||
export class AnnotationWrapper implements IListable, Record<string, unknown> {
|
||||
[x: string]: unknown;
|
||||
@ -360,6 +362,15 @@ export class AnnotationWrapper implements IListable, Record<string, unknown> {
|
||||
private static _setSuperType(annotationWrapper: AnnotationWrapper, redactionLogEntryWrapper: RedactionLogEntry) {
|
||||
if (redactionLogEntryWrapper.manualChanges?.length) {
|
||||
const lastRelevantManualChange = this._getLastRelevantManualChange(redactionLogEntryWrapper.manualChanges);
|
||||
const viableChanges = redactionLogEntryWrapper.changes.filter(c => c.analysisNumber > 1);
|
||||
const lastChange = viableChanges.sort(chronologicallyBy(x => x.dateTime)).at(-1);
|
||||
const lastChangeOccurredAfterLastManualChange =
|
||||
timestampOf(lastChange.dateTime) > timestampOf(lastRelevantManualChange.processedDate);
|
||||
|
||||
if (lastChangeOccurredAfterLastManualChange && lastChange.type === ChangeTypes.ADDED && redactionLogEntryWrapper.redacted) {
|
||||
annotationWrapper.superType = SuperTypes.Redaction;
|
||||
return;
|
||||
}
|
||||
|
||||
annotationWrapper.pending = !lastRelevantManualChange.processed;
|
||||
|
||||
|
||||
@ -34,11 +34,11 @@ import { ViewedPagesMapService } from '@services/files/viewed-pages-map.service'
|
||||
|
||||
const DELTA_VIEW_TIME = 10 * 60 * 1000; // 10 minutes;
|
||||
|
||||
function timestampOf(value: string) {
|
||||
export function timestampOf(value: string) {
|
||||
return dayjs(value).valueOf();
|
||||
}
|
||||
|
||||
function chronologicallyBy<T>(property: (x: T) => string) {
|
||||
export function chronologicallyBy<T>(property: (x: T) => string) {
|
||||
return (a: T, b: T) => timestampOf(property(a)) - timestampOf(property(b));
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"ADMIN_CONTACT_NAME": null,
|
||||
"ADMIN_CONTACT_URL": null,
|
||||
"API_URL": "https://dom2.iqser.cloud/redaction-gateway-v1",
|
||||
"API_URL": "https://dev-08.iqser.cloud/redaction-gateway-v1",
|
||||
"APP_NAME": "RedactManager",
|
||||
"AUTO_READ_TIME": 3,
|
||||
"BACKEND_APP_VERSION": "4.4.40",
|
||||
@ -11,7 +11,7 @@
|
||||
"MAX_RETRIES_ON_SERVER_ERROR": 3,
|
||||
"OAUTH_CLIENT_ID": "redaction",
|
||||
"OAUTH_IDP_HINT": null,
|
||||
"OAUTH_URL": "https://dom2.iqser.cloud/auth",
|
||||
"OAUTH_URL": "https://dev-08.iqser.cloud/auth",
|
||||
"RECENT_PERIOD_IN_HOURS": 24,
|
||||
"SELECTION_MODE": "structural",
|
||||
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user