diff options
5 files changed, 3 insertions, 23 deletions
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java index 1994890b3d5..2ef310f5964 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java @@ -176,7 +176,7 @@ public abstract class IssueChangesEmailTemplate implements EmailTemplate { s.append("<small>"); s.append("You received this email because you are subscribed to ") .append('"').append(i18n.message(Locale.ENGLISH, notificationI18nKey, notificationI18nKey)).append('"') - .append(" notifications from ").append(settings.getInstanceName()).append("."); + .append(" notifications from SonarQube."); s.append(" Click "); link(s, s1 -> s1.append(settings.getServerBaseURL()).append("/account/notifications"), s1 -> s1.append("here")); s.append(" to edit your email preferences."); diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssuesEmailTemplateTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssuesEmailTemplateTest.java index d67292ed38a..be9eb70d140 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssuesEmailTemplateTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssuesEmailTemplateTest.java @@ -227,11 +227,9 @@ public class ChangesOnMyIssuesEmailTemplateTest { private void format_set_html_message_with_footer(Change change, String issueStatus, Function<HtmlParagraphAssert, HtmlListAssert> skipContent) { String wordingNotification = randomAlphabetic(20); String host = randomAlphabetic(15); - String instance = randomAlphabetic(17); when(i18n.message(Locale.ENGLISH, "notification.dispatcher.ChangesOnMyIssue", "notification.dispatcher.ChangesOnMyIssue")) .thenReturn(wordingNotification); when(emailSettings.getServerBaseURL()).thenReturn(host); - when(emailSettings.getInstanceName()).thenReturn(instance); Project project = newProject("foo"); Rule rule = newRule("bar"); Set<ChangedIssue> changedIssues = IntStream.range(0, 2 + new Random().nextInt(4)) @@ -249,7 +247,7 @@ public class ChangesOnMyIssuesEmailTemplateTest { // skip content HtmlListAssert htmlListAssert = skipContent.apply(htmlAssert); - String footerText = "You received this email because you are subscribed to \"" + wordingNotification + "\" notifications from " + instance + "." + String footerText = "You received this email because you are subscribed to \"" + wordingNotification + "\" notifications from SonarQube." + " Click here to edit your email preferences."; htmlListAssert.hasEmptyParagraph() .hasParagraph(footerText) diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/FpOrWontFixEmailTemplateTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/FpOrWontFixEmailTemplateTest.java index 5d6003e6f74..cf8c4b221f6 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/FpOrWontFixEmailTemplateTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/FpOrWontFixEmailTemplateTest.java @@ -134,15 +134,13 @@ public class FpOrWontFixEmailTemplateTest { public void formats_returns_html_message_with_only_footer_and_header_when_no_issue(Change change, FpOrWontFix fpOrWontFix, String fpOrWontFixLabel) { String wordingNotification = randomAlphabetic(20); String host = randomAlphabetic(15); - String instance = randomAlphabetic(17); when(i18n.message(Locale.ENGLISH, "notification.dispatcher.NewFalsePositiveIssue", "notification.dispatcher.NewFalsePositiveIssue")) .thenReturn(wordingNotification); when(emailSettings.getServerBaseURL()).thenReturn(host); - when(emailSettings.getInstanceName()).thenReturn(instance); EmailMessage emailMessage = underTest.format(new FPOrWontFixNotification(change, Collections.emptySet(), fpOrWontFix)); - String footerText = "You received this email because you are subscribed to \"" + wordingNotification + "\" notifications from " + instance + "." + String footerText = "You received this email because you are subscribed to \"" + wordingNotification + "\" notifications from SonarQube." + " Click here to edit your email preferences."; HtmlFragmentAssert.assertThat(emailMessage.getMessage()) .hasParagraph("Hi,") diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java index 061d93c1b66..fb7d3600758 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java @@ -98,10 +98,6 @@ public class EmailSettings { return server.getPublicRootUrl(); } - public String getInstanceName() { - return config.getBoolean("sonar.sonarcloud.enabled").orElse(false) ? "SonarCloud" : "SonarQube"; - } - private String get(String key, String defaultValue) { return config.get(key).orElse(defaultValue); } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/EmailSettingsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/EmailSettingsTest.java index 8de07ea19a0..412e29d5a98 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/config/EmailSettingsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/config/EmailSettingsTest.java @@ -55,18 +55,6 @@ public class EmailSettingsTest { } @Test - public void getInstanceName_returns_sonarqube_when_not_on_SonarCloud() { - assertThat(underTest.getInstanceName()).isEqualTo("SonarQube"); - } - - @Test - public void getInstanceName_returns_sonarcloud_on_SonarCloud() { - settings.setProperty("sonar.sonarcloud.enabled", true); - - assertThat(underTest.getInstanceName()).isEqualTo("SonarCloud"); - } - - @Test public void return_definitions() { assertThat(EmailSettings.definitions()).hasSize(8); } |