From 62fe3fb0489f95bcffe52b7fe77767273c3f8cc5 Mon Sep 17 00:00:00 2001 From: George Date: Thu, 27 Jul 2023 19:02:57 +0300 Subject: [PATCH] RED-7069, fix reading from undefined. --- .../edit-redaction-dialog.component.ts | 6 ++++-- .../file-preview/services/annotation-actions.service.ts | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts index 7d8767236..57ed4cc13 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts @@ -27,6 +27,7 @@ export class EditRedactionDialogComponent readonly isImage: boolean; readonly initialReason: string; readonly initialType: string; + readonly isManualRedaction: boolean; options: DetailsRadioOption[] | undefined; legalOptions: LegalBasisOption[] = []; dictionaries: Dictionary[] = []; @@ -51,13 +52,14 @@ export class EditRedactionDialogComponent this.redactedText = annotations.length === 1 && !this.isImage ? firstEntry.value : null; this.initialReason = firstEntry.legalBasis; this.initialType = firstEntry.type; + this.isManualRedaction = firstEntry.type === SuperTypes.ManualRedaction; this.form = this.#getForm(); this.form.valueChanges .pipe( tap(value => { - const reasonChanged = this.initialReason !== value.reason.legalBasis; - const typeChanged = this.initialType !== value.type; + const reasonChanged = this.initialReason !== value?.reason?.legalBasis; + const typeChanged = this.initialType !== value?.type; if (typeChanged || reasonChanged) { this.#setOptions(value.type, reasonChanged); } diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts index ac69962ac..c0a198595 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts @@ -116,8 +116,13 @@ export class AnnotationActionsService { }; const result = await this._iqserDialog.openDefault(EditRedactionDialogComponent, { data }).result(); + const requests: Observable[] = []; + if (!result) { + return; + } + const changeLegalBasisBody = annotations.map(annotation => ({ annotationId: annotation.id, legalBasis: result.legalBasis,