From 9085104f8367e0a1c6135afdddc412751ae22f72 Mon Sep 17 00:00:00 2001 From: stanislavh Date: Mon, 11 Nov 2024 10:38:15 +0100 Subject: [PATCH] SONAR-23531 Fix filter of changelog events based on mode --- .../issues/components/IssueReviewHistory.tsx | 36 +++++++++++-------- .../components/AddConditionModal.tsx | 1 + 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssueReviewHistory.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssueReviewHistory.tsx index bc3ac902a2c..643cc0759e7 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/IssueReviewHistory.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/IssueReviewHistory.tsx @@ -53,21 +53,27 @@ const getUpdatedChangelog = ( { changelog }: { changelog: IssueChangelog[] }, isStandardMode = false, ): IssueChangelog[] => - changelog.map((changelogItem) => { - const diffHasIssueStatusChange = changelogItem.diffs.some((diff) => diff.key === 'issueStatus'); - - const filteredDiffs = changelogItem.diffs.filter((diff) => { - if (diffHasIssueStatusChange && ['resolution', 'status'].includes(diff.key)) { - return false; - } - return isStandardMode ? diff.key !== 'impactSeverity' : diff.key !== 'severity'; - }); - - return { - ...changelogItem, - diffs: filteredDiffs, - }; - }); + changelog + .map((changelogItem) => { + const diffHasIssueStatusChange = changelogItem.diffs.some( + (diff) => diff.key === 'issueStatus', + ); + + const filteredDiffs = changelogItem.diffs.filter((diff) => { + if (diffHasIssueStatusChange && ['resolution', 'status'].includes(diff.key)) { + return false; + } + return isStandardMode + ? !['impactSeverity', 'cleanCodeAttribute'].includes(diff.key) + : !['severity', 'type'].includes(diff.key); + }); + + return { + ...changelogItem, + diffs: filteredDiffs, + }; + }) + .filter((changelogItem) => changelogItem.diffs.length > 0); export default function IssueReviewHistory(props: Readonly) { const { issue } = props; diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionModal.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionModal.tsx index dbf4802d8dc..302d01bff5c 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionModal.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionModal.tsx @@ -51,6 +51,7 @@ const FORBIDDEN_METRICS: string[] = [ MetricKey.releasability_rating, MetricKey.security_hotspots, MetricKey.new_security_hotspots, + MetricKey.high_impact_accepted_issues, ]; const ADD_CONDITION_MODAL_ID = 'add-condition-modal'; -- 2.39.5