From 010d132cdfe0a6bb0669d9e37e3a66b27e0cc17f Mon Sep 17 00:00:00 2001 From: stanislavh Date: Fri, 15 Nov 2024 12:02:37 +0100 Subject: [PATCH] SONAR-23582 Do not show severity recommendation on rule update --- .../js/apps/coding-rules/components/CustomRuleFormModal.tsx | 2 +- .../main/js/apps/coding-rules/components/SeveritySelect.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx index 12e43b222e8..4841c3ae8f5 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx @@ -340,7 +340,7 @@ export default function CustomRuleFormModal(props: Readonly) { isDisabled={submitting} onChange={(value) => setStandardSeverity(value)} severity={standardSeverity} - recommendedSeverity={templateRule.severity ?? customRule?.severity} + recommendedSeverity={customRule?.severity ? undefined : templateRule.severity} /> ), diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx index 358c5e1ddbc..cc0969a699b 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx @@ -19,7 +19,7 @@ */ import { HelperText, Select } from '@sonarsource/echoes-react'; -import { isEmpty } from 'lodash'; +import { isEmpty, isUndefined } from 'lodash'; import { FormattedMessage, useIntl } from 'react-intl'; import SoftwareImpactSeverityIcon from '../../../components/icon-mappers/SoftwareImpactSeverityIcon'; import { SEVERITIES } from '../../../helpers/constants'; @@ -30,7 +30,7 @@ export interface SeveritySelectProps { impactSeverity?: boolean; isDisabled: boolean; onChange: (value: string) => void; - recommendedSeverity: string; + recommendedSeverity?: string; severity: string; } @@ -70,7 +70,7 @@ export function SeveritySelect(props: SeveritySelectProps) { value={severity} valueIcon={} /> - {severity !== recommendedSeverity && ( + {severity !== recommendedSeverity && !isUndefined(recommendedSeverity) && (