Merge branch 'VM/RED-7980' into 'master'

RED-7980 - Don’t allow any user actions at the original annotation while there...

Closes RED-7980

See merge request redactmanager/red-ui!349
This commit is contained in:
Dan Percic 2024-03-20 09:22:54 +01:00
commit 3e57f1e33e
3 changed files with 18 additions and 9 deletions

View File

@ -66,6 +66,7 @@ export class AnnotationWrapper implements IListable {
isRemovedLocally = false;
hiddenInWorkload = false;
lastManualChange: ManualRedactionType;
entry: IEntityLogEntry;
get isRuleBased() {
return this.engines.includes(LogEntryEngines.RULE);
@ -275,10 +276,6 @@ export class AnnotationWrapper implements IListable {
const lastRelevantManualChange = logEntry.manualChanges?.at(-1);
annotationWrapper.lastManualChange = lastRelevantManualChange?.manualRedactionType;
if (annotationWrapper.pending) {
const removedEntry = allLogEntries.find((e: IEntityLogEntry) => e.id === annotationWrapper.id);
logEntry.oldState = removedEntry?.state;
}
annotationWrapper.superType = SuperTypeMapper[logEntry.entryType][logEntry.state](logEntry);
annotationWrapper.superTypeLabel = annotationTypesTranslations[annotationWrapper.superType];
@ -295,7 +292,7 @@ export class AnnotationWrapper implements IListable {
annotationWrapper.color = dictionary ? (dictionary[colorKey] as string) : (defaultColors[defaultColor] as string);
}
annotationWrapper['entry'] = logEntry;
annotationWrapper.entry = logEntry;
return annotationWrapper;
}

View File

@ -228,6 +228,12 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
const changeType = this.#getChangeLogType(entry, file);
if (entry.state === EntryStates.PENDING) {
const originalAnnotation = this.#findOriginalAnnotation(annotations, entry);
entry.oldState = originalAnnotation.entry.state;
originalAnnotation.pending = true;
}
const annotation = AnnotationWrapper.fromData(
entry,
entityLog.entityLogEntry,
@ -303,4 +309,12 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
annotations.push(pendingAnnotation);
}
}
#findOriginalAnnotation(annotations: AnnotationWrapper[], pendingEntry: IEntityLogEntry) {
for (let i = annotations.length - 1; i >= 0; i--) {
if (annotations[i].id === pendingEntry.id) {
return annotations[i];
}
}
}
}

View File

@ -132,7 +132,7 @@ export class AnnotationDrawService {
return;
}
if (annotationWrapper.pending) {
if (annotationWrapper.pending && annotationWrapper.id.includes('pending')) {
const polylineAnnot = this._pdf.polyline();
polylineAnnot.ReadOnly = true;
polylineAnnot.StrokeColor = this.convertColor(annotationWrapper.color);
@ -140,8 +140,6 @@ export class AnnotationDrawService {
polylineAnnot.Id = annotationWrapper.id;
polylineAnnot.PageNumber = pageNumber;
polylineAnnot.Opacity = polylineAnnot.Id.endsWith('pending') ? 0 : 0.5;
console.log(polylineAnnot.Id);
console.log(polylineAnnot.Id.split('-'));
const points = this.#computePolylinePoints(annotationWrapper.positions, annotationWrapper.pageNumber);
for (let i = 0; i < points.length; i++) {
@ -190,7 +188,7 @@ export class AnnotationDrawService {
annotation.setCustomData('skipped', String(annotationWrapper.isSkipped));
annotation.setCustomData('changeLog', String(annotationWrapper.isChangeLogEntry));
annotation.setCustomData('changeLogRemoved', String(annotationWrapper.isRemoved));
annotation.setCustomData('opacity', String(!annotationWrapper.pending ? annotation.Opacity : annotation.Opacity / 2));
annotation.setCustomData('opacity', String(annotation.Opacity));
const redactionColor = this._defaultColorsService.getColor(dossierTemplateId, 'previewColor');
annotation.setCustomData('redactionColor', String(redactionColor));