RED-5912 - Suggestions make redactions disappear in PREVIEW mode

This commit is contained in:
Valentin Mihai 2023-05-29 16:55:54 +02:00
parent b8d6d36f17
commit b01d3851fe
3 changed files with 10 additions and 4 deletions

View File

@ -26,13 +26,17 @@ export class SuggestionsService {
hideSuggestionsInPreview(annotations: Annotation[]): void {
if (this._readableRedactionsService.active) {
if (this._userPreferenceService.getDisplaySuggestionsInPreview()) {
const suggestionsRemove = annotations.filter(a => bool(a.getCustomData('suggestionRemove')));
const suggestionsRemove = annotations.filter(
a => bool(a.getCustomData('suggestionRemove')) || bool(a.getCustomData('suggestionRecategorizeImage')),
);
this._annotationManager.hide(suggestionsRemove);
return;
}
}
const suggestionsToHide = annotations.filter(
a => bool(a.getCustomData('suggestionAdd')) && !bool(a.getCustomData('suggestionAddToFalsePositive')),
a =>
(bool(a.getCustomData('suggestionAdd')) && !bool(a.getCustomData('suggestionAddToFalsePositive'))) ||
bool(a.getCustomData('suggestionRecategorizeImage')),
);
annotations.forEach(a => {
if (bool(a.getCustomData('suggestionRemove'))) {
@ -52,7 +56,7 @@ export class SuggestionsService {
}
}
annotations = annotations.filter(a => !a.isSuggestionAdd || a.isSuggestionAddToFalsePositive);
annotations = annotations.filter(a => (!a.isSuggestionAdd || a.isSuggestionAddToFalsePositive) && !a.isSuggestionRecategorizeImage);
for (let i = annotations.length - 1; i >= 0; i--) {
const foundRemovedRedaction = this.#removedRedactions.find(r => r.id === annotations[i].id);
if (foundRemovedRedaction) {

View File

@ -159,6 +159,7 @@ export class AnnotationDrawService {
annotation.setCustomData('suggestionAdd', String(annotationWrapper.isSuggestionAdd));
annotation.setCustomData('suggestionAddToFalsePositive', String(annotationWrapper.isSuggestionAddToFalsePositive));
annotation.setCustomData('suggestionRemove', String(annotationWrapper.isSuggestionRemove));
annotation.setCustomData('suggestionRecategorizeImage', String(annotationWrapper.isSuggestionRecategorizeImage));
annotation.setCustomData('skipped', String(annotationWrapper.isSkipped));
annotation.setCustomData('changeLog', String(annotationWrapper.isChangeLogEntry));
annotation.setCustomData('changeLogRemoved', String(annotationWrapper.isChangeLogRemoved));

View File

@ -79,7 +79,8 @@ export class ReadableRedactionsService {
setAnnotationsOpacity(annotations: Annotation[], restoreToOriginal = false) {
annotations.forEach(annotation => {
annotation['Opacity'] = restoreToOriginal ? parseFloat(annotation.getCustomData('opacity')) : 0.5;
const isSuggestion = annotation.getCustomData('suggestion');
annotation['Opacity'] = restoreToOriginal || isSuggestion ? parseFloat(annotation.getCustomData('opacity')) : 0.5;
});
}