aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Suen <mathieu.suen@sonarsource.com>2022-11-15 11:31:58 +0100
committersonartech <sonartech@sonarsource.com>2022-11-16 20:03:06 +0000
commitcd212e79054b3adac35240fb6108491222785e8e (patch)
tree4f746322f3ac131fd48d9389c9cc0348cb1fe914
parente66468ca6660c2517f87f576f8f8a58493997c45 (diff)
downloadsonarqube-cd212e79054b3adac35240fb6108491222785e8e.tar.gz
sonarqube-cd212e79054b3adac35240fb6108491222785e8e.zip
SONAR-17594 Remove issue message that appears as secondary issue whilst being the primary
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx
index d0ec15e8d2a..2630d4b1add 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx
@@ -220,8 +220,12 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
const isFlow = issue.secondaryLocations.length === 0;
const includeIssueLocation = isFlow ? isLastOccurenceOfPrimaryComponent : true;
- const issuesForLine = issuesByLine[line.line] || [];
const issueLocations = includeIssueLocation ? locations[line.line] : [];
+ const issuesForLine = (issuesByLine[line.line] || []).filter(
+ (issueForline) =>
+ issue.key !== issueForline.key ||
+ (issue.key === issueForline.key && issueLocations.length > 0)
+ );
return (
issuesForLine.length > 0 && (
@@ -232,7 +236,7 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
<IssueSourceViewerScrollContext.Consumer key={issueToDisplay.key}>
{(ctx) => (
<IssueMessageBox
- selected={!!(isSelectedIssue && issueLocations.length > 0)}
+ selected={isSelectedIssue}
issue={issueToDisplay}
onClick={this.props.onIssueSelect}
ref={isSelectedIssue ? ctx?.registerPrimaryLocationRef : undefined}