From c8422b3b82856887141d9b614afc446311e18797 Mon Sep 17 00:00:00 2001
From: Philippe Perrin
Date: Mon, 11 Jul 2022 11:08:03 +0200
Subject: [PATCH] SONAR-16518 Fix "Submit an idea" link's target
---
.../coding-rules/__tests__/CodingRules-it.ts | 7 ++++-
.../components/rules/OtherContextOption.tsx | 28 ++++++-------------
.../resources/org/sonar/l10n/core.properties | 3 +-
3 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts b/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts
index c2b66033a6b..140dba40e2b 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts
+++ b/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts
@@ -164,7 +164,12 @@ it('should show rule advanced section with context', async () => {
await user.click(screen.getByRole('radio', { name: 'coding_rules.description_context_other' }));
expect(screen.getByText('coding_rules.context.others.title')).toBeInTheDocument();
expect(screen.getByText('coding_rules.context.others.description.first')).toBeInTheDocument();
- expect(screen.getByText('coding_rules.context.others.description.second')).toBeInTheDocument();
+
+ const productBoardLink = screen.getByRole('link', {
+ name: 'coding_rules.context.others.feedback_description.link'
+ });
+ expect(productBoardLink).toBeInTheDocument();
+ expect(productBoardLink).toHaveAttribute('target', '_blank');
});
it('should be able to extend the rule description', async () => {
diff --git a/server/sonar-web/src/main/js/components/rules/OtherContextOption.tsx b/server/sonar-web/src/main/js/components/rules/OtherContextOption.tsx
index 2c322ba7cf2..5651f7aa78b 100644
--- a/server/sonar-web/src/main/js/components/rules/OtherContextOption.tsx
+++ b/server/sonar-web/src/main/js/components/rules/OtherContextOption.tsx
@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { FormattedMessage } from 'react-intl';
import { translate } from '../../helpers/l10n';
import CheckIcon from '../icons/CheckIcon';
import ClearIcon from '../icons/ClearIcon';
@@ -41,24 +40,15 @@ export default function OtherContextOption() {
{translate('coding_rules.context.others.title_feedback')}
-
-
-
- {translate('coding_rules.context.others.feedback_description.link')}
-
-
-
- )
- }}
- />
-
+ {translate('coding_rules.context.others.feedback_description_1')}
+
+ {translate('coding_rules.context.others.feedback_description.link')}
+
+
+ {translate('coding_rules.context.others.feedback_description_2')}
>
);
}
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 6c29992652f..2817269072d 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -1789,7 +1789,8 @@ coding_rules.context.others.description.second=Caution: The libraries mentioned
coding_rules.context.others.description.do=Do use libraries that are compatible with the frameworks you are using.
coding_rules.context.others.description.dont=Donât blindly copy and paste the fixups into your code.
coding_rules.context.others.title_feedback=Help us improve
-coding_rules.context.others.feedback_description=Let us know if the instructions we provide do not work for you. Tell us which framework you use and why our solution does not work by submitting an idea on the SonarQube productboard. {link} We will do our best to provide you with more relevant instructions in the future.
+coding_rules.context.others.feedback_description_1=Let us know if the instructions we provide do not work for you. Tell us which framework you use and why our solution does not work by submitting an idea on the SonarQube productboard.
+coding_rules.context.others.feedback_description_2=We will do our best to provide you with more relevant instructions in the future.
coding_rules.context.others.feedback_description.link=Submit an idea
coding_rules.create=Create
coding_rules.create_custom_rule=Create Custom Rule
--
2.39.5