RED-8950 - Not possible to edit/remove manual local redaction when auto-analysis is disabled, wrong flag is used
This commit is contained in:
parent
8215b16b36
commit
dcc41044e3
@ -93,7 +93,7 @@ export class AnnotationActionsService {
|
|||||||
|
|
||||||
async editRedaction(annotations: AnnotationWrapper[]) {
|
async editRedaction(annotations: AnnotationWrapper[]) {
|
||||||
const { dossierId, dossierTemplateId, fileId, file } = this._state;
|
const { dossierId, dossierTemplateId, fileId, file } = this._state;
|
||||||
const isUnprocessed = annotations.every(annotation => annotation.pending);
|
const includeUnprocessed = annotations.every(annotation => this.#includeUnprocessed(annotation, true));
|
||||||
const dossierTemplate = this._dossierTemplatesService.find(dossierTemplateId);
|
const dossierTemplate = this._dossierTemplatesService.find(dossierTemplateId);
|
||||||
const data = {
|
const data = {
|
||||||
annotations,
|
annotations,
|
||||||
@ -126,7 +126,7 @@ export class AnnotationActionsService {
|
|||||||
dossierId,
|
dossierId,
|
||||||
fileId,
|
fileId,
|
||||||
this.#getChangedFields(annotations, result),
|
this.#getChangedFields(annotations, result),
|
||||||
file().excludedFromAutomaticAnalysis && isUnprocessed,
|
includeUnprocessed,
|
||||||
)
|
)
|
||||||
.pipe(log()),
|
.pipe(log()),
|
||||||
);
|
);
|
||||||
@ -150,7 +150,6 @@ export class AnnotationActionsService {
|
|||||||
};
|
};
|
||||||
const dossierTemplate = this._dossierTemplatesService.find(this._state.dossierTemplateId);
|
const dossierTemplate = this._dossierTemplatesService.find(this._state.dossierTemplateId);
|
||||||
const isApprover = this._permissionsService.isApprover(this._state.dossier());
|
const isApprover = this._permissionsService.isApprover(this._state.dossier());
|
||||||
const isUnprocessed = redactions.every(annotation => annotation.pending);
|
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
redactions,
|
redactions,
|
||||||
@ -173,7 +172,7 @@ export class AnnotationActionsService {
|
|||||||
) {
|
) {
|
||||||
this.#setAsFalsePositive(redactions, result);
|
this.#setAsFalsePositive(redactions, result);
|
||||||
} else {
|
} else {
|
||||||
this.#removeRedaction(redactions, result, this._state.file().excludedFromAutomaticAnalysis && isUnprocessed);
|
this.#removeRedaction(redactions, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,6 +224,7 @@ export class AnnotationActionsService {
|
|||||||
|
|
||||||
async acceptResize(annotation: AnnotationWrapper, permissions: AnnotationPermissions): Promise<void> {
|
async acceptResize(annotation: AnnotationWrapper, permissions: AnnotationPermissions): Promise<void> {
|
||||||
const textAndPositions = await this.#extractTextAndPositions(annotation.id);
|
const textAndPositions = await this.#extractTextAndPositions(annotation.id);
|
||||||
|
const includeUnprocessed = this.#includeUnprocessed(annotation);
|
||||||
if (annotation.isRecommendation) {
|
if (annotation.isRecommendation) {
|
||||||
const recommendation = {
|
const recommendation = {
|
||||||
...annotation,
|
...annotation,
|
||||||
@ -276,12 +276,7 @@ export class AnnotationActionsService {
|
|||||||
await this.cancelResize(annotation);
|
await this.cancelResize(annotation);
|
||||||
|
|
||||||
const { fileId, dossierId, file } = this._state;
|
const { fileId, dossierId, file } = this._state;
|
||||||
const request = this._manualRedactionService.resize(
|
const request = this._manualRedactionService.resize([resizeRequest], dossierId, fileId, includeUnprocessed);
|
||||||
[resizeRequest],
|
|
||||||
dossierId,
|
|
||||||
fileId,
|
|
||||||
isUnprocessed && file().excludedFromAutomaticAnalysis,
|
|
||||||
);
|
|
||||||
return this.#processObsAndEmit(request);
|
return this.#processObsAndEmit(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,8 +431,9 @@ export class AnnotationActionsService {
|
|||||||
this.#processObsAndEmit(this._manualRedactionService.addAnnotation(requests, dossierId, fileId)).then();
|
this.#processObsAndEmit(this._manualRedactionService.addAnnotation(requests, dossierId, fileId)).then();
|
||||||
}
|
}
|
||||||
|
|
||||||
#removeRedaction(redactions: AnnotationWrapper[], dialogResult: RemoveRedactionResult, includeUnprocessed = false) {
|
#removeRedaction(redactions: AnnotationWrapper[], dialogResult: RemoveRedactionResult) {
|
||||||
const removeFromDictionary = dialogResult.option.value === RemoveRedactionOptions.IN_DOSSIER;
|
const removeFromDictionary = dialogResult.option.value === RemoveRedactionOptions.IN_DOSSIER;
|
||||||
|
const includeUnprocessed = redactions.every(redaction => this.#includeUnprocessed(redaction, true));
|
||||||
const body = redactions.map(redaction => ({
|
const body = redactions.map(redaction => ({
|
||||||
annotationId: redaction.id,
|
annotationId: redaction.id,
|
||||||
comment: dialogResult.comment,
|
comment: dialogResult.comment,
|
||||||
@ -504,4 +500,18 @@ export class AnnotationActionsService {
|
|||||||
}
|
}
|
||||||
return { changes: changedFields.join(', ') };
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user