From e484927f61697239de96351680339900d8d0115e Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Wed, 4 May 2022 14:59:09 +0300 Subject: [PATCH] RED-3958: return annotation value for false recommendations --- .../services/annotation-actions.service.ts | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 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 faa35213f..5d33b65f1 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 @@ -501,19 +501,26 @@ export class AnnotationActionsService { } private _getFalsePositiveText(annotation: AnnotationWrapper) { - if (annotation.canBeMarkedAsFalsePositive) { - let text: string; - if (annotation.hasTextAfter) { - text = getFirstRelevantTextPart(annotation.textAfter, 'FORWARD'); - return text ? (annotation.value + text).trim() : annotation.value; - } - if (annotation.hasTextAfter) { - text = getFirstRelevantTextPart(annotation.textBefore, 'BACKWARD'); - return text ? (text + annotation.value).trim() : annotation.value; - } else { - return annotation.value; - } + if (!annotation.canBeMarkedAsFalsePositive) { + return; } + + if (annotation.isRecommendation) { + return annotation.value; + } + + let text: string; + if (annotation.hasTextAfter) { + text = getFirstRelevantTextPart(annotation.textAfter, 'FORWARD'); + return text ? (annotation.value + text).trim() : annotation.value; + } + + if (annotation.hasTextBefore) { + text = getFirstRelevantTextPart(annotation.textBefore, 'BACKWARD'); + return text ? (text + annotation.value).trim() : annotation.value; + } + + return annotation.value; } private _convertPath(path: string): string {