fixed .find of undefined manualRedaction
This commit is contained in:
parent
1749cb20c4
commit
b94884a09d
@ -67,6 +67,7 @@ export class AnnotationWrapper {
|
||||
hasBeenForcedHint: boolean;
|
||||
hasBeenForcedRedaction: boolean;
|
||||
hasBeenRemovedByManualOverride: boolean;
|
||||
redactionLogEntry: any;
|
||||
|
||||
get isChangeLogRemoved() {
|
||||
return this.changeLogType === 'REMOVED';
|
||||
@ -232,7 +233,7 @@ export class AnnotationWrapper {
|
||||
get legalBasis() {
|
||||
return this.legalBasisChangeValue || this.legalBasisValue;
|
||||
}
|
||||
redactionLogEntry: any;
|
||||
|
||||
static fromData(redactionLogEntry?: RedactionLogEntry) {
|
||||
const annotationWrapper = new AnnotationWrapper();
|
||||
|
||||
@ -257,22 +258,22 @@ export class AnnotationWrapper {
|
||||
annotationWrapper.section = redactionLogEntry.section;
|
||||
annotationWrapper.reference = redactionLogEntry.reference || [];
|
||||
annotationWrapper.rectangle = redactionLogEntry.rectangle;
|
||||
annotationWrapper.hasBeenResized = !!redactionLogEntry.manualChanges.find(
|
||||
annotationWrapper.hasBeenResized = !!redactionLogEntry.manualChanges?.find(
|
||||
c => c.manualRedactionType === ManualRedactionType.RESIZE && c.annotationStatus === LogEntryStatus.APPROVED,
|
||||
);
|
||||
annotationWrapper.hasBeenRecategorized = !!redactionLogEntry.manualChanges.find(
|
||||
annotationWrapper.hasBeenRecategorized = !!redactionLogEntry.manualChanges?.find(
|
||||
c => c.manualRedactionType === ManualRedactionType.RECATEGORIZE && c.annotationStatus === LogEntryStatus.APPROVED,
|
||||
);
|
||||
annotationWrapper.hasLegalBasisChanged = !!redactionLogEntry.manualChanges.find(
|
||||
annotationWrapper.hasLegalBasisChanged = !!redactionLogEntry.manualChanges?.find(
|
||||
c => c.manualRedactionType === ManualRedactionType.LEGAL_BASIS_CHANGE && c.annotationStatus === LogEntryStatus.APPROVED,
|
||||
);
|
||||
annotationWrapper.hasBeenForcedHint = !!redactionLogEntry.manualChanges.find(
|
||||
annotationWrapper.hasBeenForcedHint = !!redactionLogEntry.manualChanges?.find(
|
||||
c => c.manualRedactionType === ManualRedactionType.FORCE_HINT && c.annotationStatus === LogEntryStatus.APPROVED,
|
||||
);
|
||||
annotationWrapper.hasBeenForcedRedaction = !!redactionLogEntry.manualChanges.find(
|
||||
annotationWrapper.hasBeenForcedRedaction = !!redactionLogEntry.manualChanges?.find(
|
||||
c => c.manualRedactionType === ManualRedactionType.FORCE_REDACT && c.annotationStatus === LogEntryStatus.APPROVED,
|
||||
);
|
||||
annotationWrapper.hasBeenRemovedByManualOverride = !!redactionLogEntry.manualChanges.find(
|
||||
annotationWrapper.hasBeenRemovedByManualOverride = !!redactionLogEntry.manualChanges?.find(
|
||||
c => c.manualRedactionType === ManualRedactionType.REMOVE_LOCALLY && c.annotationStatus === LogEntryStatus.APPROVED,
|
||||
);
|
||||
|
||||
@ -297,7 +298,7 @@ export class AnnotationWrapper {
|
||||
return;
|
||||
}
|
||||
|
||||
if (redactionLogEntryWrapper.manualChanges.length) {
|
||||
if (redactionLogEntryWrapper.manualChanges?.length) {
|
||||
const lastManualChange = redactionLogEntryWrapper.manualChanges[redactionLogEntryWrapper.manualChanges.length - 1];
|
||||
|
||||
annotationWrapper.pending = !lastManualChange.processed;
|
||||
@ -375,6 +376,7 @@ export class AnnotationWrapper {
|
||||
case LogEntryStatus.REQUESTED:
|
||||
return 'suggestion-add';
|
||||
}
|
||||
break;
|
||||
case ManualRedactionType.ADD_TO_DICTIONARY:
|
||||
switch (lastManualChange.annotationStatus) {
|
||||
case LogEntryStatus.APPROVED:
|
||||
|
||||
@ -105,7 +105,7 @@ export class FileDataModel {
|
||||
);
|
||||
|
||||
if (
|
||||
redactionLogEntry.manualChanges.find(
|
||||
redactionLogEntry.manualChanges?.find(
|
||||
mc =>
|
||||
mc.manualRedactionType === ManualRedactionType.ADD_TO_DICTIONARY &&
|
||||
(mc.annotationStatus === LogEntryStatus.APPROVED || mc.annotationStatus === LogEntryStatus.REQUESTED),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user