RED-3648 - Fixed updatestatus and undo to only perform the action on the most recent manual change

This commit is contained in:
Timo Bejan 2022-04-28 17:38:58 +03:00
parent 259202271f
commit 0a46b028bb
2 changed files with 13 additions and 9 deletions

View File

@ -303,20 +303,24 @@ export class AnnotationWrapper implements IListable, Record<string, unknown> {
}
}
private static _getLastRelevantManualChange(manualChanges: IManualChange[]) {
return manualChanges[manualChanges.length - 1];
}
private static _setSuperType(annotationWrapper: AnnotationWrapper, redactionLogEntryWrapper: RedactionLogEntry) {
if (redactionLogEntryWrapper.manualChanges?.length) {
const lastManualChange = redactionLogEntryWrapper.manualChanges[redactionLogEntryWrapper.manualChanges.length - 1];
const lastRelevantManualChange = this._getLastRelevantManualChange(redactionLogEntryWrapper.manualChanges);
annotationWrapper.pending = !lastManualChange.processed;
annotationWrapper.pending = !lastRelevantManualChange.processed;
annotationWrapper.superType = AnnotationWrapper._selectSuperType(
redactionLogEntryWrapper,
lastManualChange,
lastRelevantManualChange,
annotationWrapper.hintDictionary,
);
if (lastManualChange.annotationStatus === LogEntryStatus.REQUESTED) {
annotationWrapper.recategorizationType = lastManualChange.propertyChanges.type;
if (lastRelevantManualChange.annotationStatus === LogEntryStatus.REQUESTED) {
annotationWrapper.recategorizationType = lastRelevantManualChange.propertyChanges.type;
}
} else {
if (redactionLogEntryWrapper.recommendation) {
@ -418,7 +422,7 @@ export class AnnotationWrapper implements IListable, Record<string, unknown> {
case LogEntryStatus.APPROVED:
return SuperTypes.Redaction;
case LogEntryStatus.DECLINED:
return SuperTypes.Skipped;
return isHintDictionary ? SuperTypes.IgnoredHint : SuperTypes.Skipped;
case LogEntryStatus.REQUESTED:
return SuperTypes.SuggestionForceRedaction;
}
@ -444,7 +448,7 @@ export class AnnotationWrapper implements IListable, Record<string, unknown> {
} else if (redactionLogEntry.hint) {
return SuperTypes.Hint;
} else {
return SuperTypes.Skipped;
return isHintDictionary ? SuperTypes.IgnoredHint : SuperTypes.Skipped;
}
}
case LogEntryStatus.REQUESTED:
@ -471,7 +475,7 @@ export class AnnotationWrapper implements IListable, Record<string, unknown> {
} else if (redactionLogEntry.hint) {
return SuperTypes.Hint;
} else {
return SuperTypes.Skipped;
return isHintDictionary ? SuperTypes.IgnoredHint : SuperTypes.Skipped;
}
case LogEntryStatus.REQUESTED:
return SuperTypes.SuggestionResize;

View File

@ -396,7 +396,7 @@ export class AnnotationActionsService {
annotationWrapper.resizing = true;
const viewerAnnotation = this._pdf.annotationManager.getAnnotationById(annotationWrapper.id);
if (annotationWrapper.rectangle || annotationWrapper.imported) {
if (annotationWrapper.rectangle || annotationWrapper.imported || annotationWrapper.isImage) {
this._pdf.deleteAnnotations([annotationWrapper.id]);
const rectangleAnnotation = this.#generateRectangle(annotationWrapper);
this._pdf.annotationManager.addAnnotation(rectangleAnnotation, { imported: true });