From b620605613dd386cc1e31ab5fc86e2f51de550b0 Mon Sep 17 00:00:00 2001 From: Kilian Schuettler Date: Fri, 25 Oct 2024 13:50:27 +0200 Subject: [PATCH] RED-10264: remove includeUnprocessed from all manual change calls --- .../services/annotation-actions.service.ts | 22 +------------ .../services/manual-redaction.service.ts | 33 +++++-------------- 2 files changed, 9 insertions(+), 46 deletions(-) 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 852c3b9e3..fc703931a 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 @@ -114,7 +114,6 @@ export class AnnotationActionsService { async editRedaction(annotations: AnnotationWrapper[]) { const { dossierId, file } = this._state; const allFileAnnotations = this._fileDataService.annotations(); - const includeUnprocessed = annotations.every(annotation => this.#includeUnprocessed(annotation, true)); const data = { annotations, allFileAnnotations, @@ -170,7 +169,6 @@ export class AnnotationActionsService { dossierId, file().id, this.#getChangedFields(annotations, result), - includeUnprocessed, result.option === RedactOrHintOptions.IN_DOCUMENT || !!result.pageNumbers.length, ) .pipe(log()), @@ -269,7 +267,6 @@ export class AnnotationActionsService { async acceptResize(annotation: AnnotationWrapper, permissions: AnnotationPermissions): Promise { const textAndPositions = await this.#extractTextAndPositions(annotation.id); - const includeUnprocessed = this.#includeUnprocessed(annotation); if (annotation.isRecommendation) { const recommendation = { ...annotation, @@ -320,7 +317,7 @@ export class AnnotationActionsService { await this.cancelResize(annotation); const { fileId, dossierId } = this._state; - const request = this._manualRedactionService.resize([resizeRequest], dossierId, fileId, includeUnprocessed); + const request = this._manualRedactionService.resize([resizeRequest], dossierId, fileId); return this.#processObsAndEmit(request); } @@ -477,7 +474,6 @@ export class AnnotationActionsService { #removeRedaction(redactions: AnnotationWrapper[], dialogResult: RemoveRedactionResult) { const removeFromDictionary = dialogResult.option.value === RemoveRedactionOptions.IN_DOSSIER; - const includeUnprocessed = redactions.every(redaction => this.#includeUnprocessed(redaction, true)); const body = this.#getRemoveRedactionBody(redactions, dialogResult); // todo: might not be correct, probably shouldn't get to this point if they are not all the same const isHint = redactions.every(r => r.isHint); @@ -505,7 +501,6 @@ export class AnnotationActionsService { fileId, removeFromDictionary, isHint, - includeUnprocessed, dialogResult.bulkLocal, ), ), @@ -521,7 +516,6 @@ export class AnnotationActionsService { fileId, removeFromDictionary, isHint, - includeUnprocessed, dialogResult.bulkLocal || !!dialogResult.pageNumbers.length, ), ).then(); @@ -580,20 +574,6 @@ export class AnnotationActionsService { return { changes: changedFields.join(', ') }; } - //TODO this is temporary, based on RED-8950. Should be removed when a better solution will be found - #includeUnprocessed(annotation: AnnotationWrapper, isRemoveOrRecategorize = false) { - const processed = annotation.entry.manualChanges.at(-1)?.processed; - if (!processed) { - const autoAnalysisDisabled = this._state.file().excludedFromAutomaticAnalysis; - const addedLocallyWhileDisabled = annotation.manual; - if (autoAnalysisDisabled) { - return addedLocallyWhileDisabled; - } - return isRemoveOrRecategorize && addedLocallyWhileDisabled; - } - return false; - } - #getRemoveRedactionBody( redactions: AnnotationWrapper[], dialogResult: RemoveRedactionResult, diff --git a/apps/red-ui/src/app/modules/file-preview/services/manual-redaction.service.ts b/apps/red-ui/src/app/modules/file-preview/services/manual-redaction.service.ts index e8017d6df..524717c07 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/manual-redaction.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/manual-redaction.service.ts @@ -75,13 +75,10 @@ export class ManualRedactionService extends GenericService { body: List | IBulkRecategorizationRequest, dossierId: string, fileId: string, - successMessageParameters?: { - [key: string]: string; - }, - includeUnprocessed = false, + successMessageParameters?: { [p: string]: string }, bulkLocal = false, ) { - return this.#recategorize(body, dossierId, fileId, includeUnprocessed, bulkLocal).pipe( + return this.#recategorize(body, dossierId, fileId, bulkLocal).pipe( this.#showToast('recategorize-annotation', false, successMessageParameters), ); } @@ -117,10 +114,9 @@ export class ManualRedactionService extends GenericService { fileId: string, removeFromDictionary = false, isHint = false, - includeUnprocessed = false, bulkLocal = false, ) { - return this.#remove(body, dossierId, fileId, includeUnprocessed, bulkLocal).pipe( + return this.#remove(body, dossierId, fileId, bulkLocal).pipe( this.#showToast(!isHint ? 'remove' : 'remove-hint', removeFromDictionary), ); } @@ -154,36 +150,23 @@ export class ManualRedactionService extends GenericService { return this._post(body, `${this.#bulkRedaction}/force/${dossierId}/${fileId}`).pipe(this.#log('Force redaction', body)); } - resize(body: List, dossierId: string, fileId: string, includeUnprocessed = false) { - return this._post(body, `${this.#bulkRedaction}/resize/${dossierId}/${fileId}?includeUnprocessed=${includeUnprocessed}`).pipe( - this.#log('Resize', body), - ); + resize(body: List, dossierId: string, fileId: string) { + return this._post(body, `${this.#bulkRedaction}/resize/${dossierId}/${fileId}`).pipe(this.#log('Resize', body)); } #recategorize( body: List | IBulkRecategorizationRequest, dossierId: string, fileId: string, - includeUnprocessed = false, bulkLocal = false, ) { const bulkPath = bulkLocal ? this.#bulkLocal : this.#bulkRedaction; - return this._post(body, `${bulkPath}/recategorize/${dossierId}/${fileId}?includeUnprocessed=${includeUnprocessed}`).pipe( - this.#log('Recategorize', body), - ); + return this._post(body, `${bulkPath}/recategorize/${dossierId}/${fileId}`).pipe(this.#log('Recategorize', body)); } - #remove( - body: List | IBulkLocalRemoveRequest, - dossierId: string, - fileId: string, - includeUnprocessed = false, - bulkLocal = false, - ) { + #remove(body: List | IBulkLocalRemoveRequest, dossierId: string, fileId: string, bulkLocal = false) { const bulkPath = bulkLocal ? this.#bulkLocal : this.#bulkRedaction; - return this._post(body, `${bulkPath}/remove/${dossierId}/${fileId}?includeUnprocessed=${includeUnprocessed}`).pipe( - this.#log('Remove', body), - ); + return this._post(body, `${bulkPath}/remove/${dossierId}/${fileId}`).pipe(this.#log('Remove', body)); } #log(action: string, body: unknown) {