RED-3791: use add endpoint when resizing recommendation

This commit is contained in:
Dan Percic 2022-07-05 15:21:06 +03:00
parent f46a787f55
commit 2d703a675e
2 changed files with 19 additions and 2 deletions

View File

@ -428,7 +428,14 @@ export class AnnotationActionsService {
updateDictionary: result.updateDictionary,
};
this._processObsAndEmit(this._manualRedactionService.resizeOrSuggestResize([resizeRequest], this._dossier.id, fileId));
let obs;
if (annotation.isRecommendation) {
obs = this.#convertRecommendationToRedaction(resizeRequest, annotation, fileId);
} else {
obs = this._manualRedactionService.resizeOrSuggestResize([resizeRequest], this._dossier.id, fileId);
}
this._processObsAndEmit(obs);
});
}
@ -462,6 +469,16 @@ export class AnnotationActionsService {
this._processObsAndEmit(this._manualRedactionService.addAnnotation(requests, dossierId, fileId));
}
#convertRecommendationToRedaction(resizeRequest: IResizeRequest, annotation: AnnotationWrapper, fileId: string) {
const addRequest: IAddRedactionRequest = {
...resizeRequest,
comment: resizeRequest.comment ? { text: resizeRequest.comment } : null,
reason: 'Dictionary Request',
type: annotation.type,
};
return this._manualRedactionService.add([addRequest], this._dossier.id, fileId);
}
#generateRectangle(annotationWrapper: AnnotationWrapper) {
const annotation = this._pdf.rectangle();
const pageHeight = this._documentViewer.getHeight(annotationWrapper.pageNumber);

@ -1 +1 @@
Subproject commit 8993d7c2de02c052206b6c40b105325bed85b2d8
Subproject commit 7835b1caf0c28df32abf6a8751a7fcf9d2a9716f