]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-23531 Fix filter of changelog events based on mode
authorstanislavh <stanislav.honcharov@sonarsource.com>
Mon, 11 Nov 2024 09:38:15 +0000 (10:38 +0100)
committersonartech <sonartech@sonarsource.com>
Mon, 11 Nov 2024 20:02:45 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/issues/components/IssueReviewHistory.tsx
server/sonar-web/src/main/js/apps/quality-gates/components/AddConditionModal.tsx

index bc3ac902a2ca4d52b26b6c5b482beb8a1db5f260..643cc0759e7d152ce7403cfe3cec92c1583c1811 100644 (file)
@@ -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<HotspotReviewHistoryProps>) {
   const { issue } = props;
index dbf4802d8dc6a50de86ffb1b4ffaed63d5764693..302d01bff5c366f70fe1a85e67fae0c3ba8deede 100644 (file)
@@ -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';