]> source.dussan.org Git - sonarqube.git/commitdiff
SC-795 remove SonarCloud label from emails
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 9 Jul 2019 07:07:58 +0000 (09:07 +0200)
committerSonarTech <sonartech@sonarsource.com>
Fri, 26 Jul 2019 18:21:46 +0000 (20:21 +0200)
server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java
server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssuesEmailTemplateTest.java
server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/FpOrWontFixEmailTemplateTest.java
sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java
sonar-plugin-api/src/test/java/org/sonar/api/config/EmailSettingsTest.java

index 1994890b3d5c80091857edf646dda3c90fa08430..2ef310f596405a0af59103dbe3508f4b99e09d6f 100644 (file)
@@ -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.");
index d67292ed38a9bfd3e0cbaedd546e10808ad38d10..be9eb70d14055914ecb6171108c752b584bb9eeb 100644 (file)
@@ -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)
index 5d6003e6f74868cbef62f6ec2e8d3d92988aeb15..cf8c4b221f6f7626e78b57be1234e668f9823b15 100644 (file)
@@ -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,")
index 061d93c1b66aae31fe97c3898f0d03c1133f0bfc..fb7d36007581eb992aa316383719d6b35f6375ba 100644 (file)
@@ -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);
   }
index 8de07ea19a02ee962da6f7646d9e7a2014efb8d4..412e29d5a98a02ee6d419ab582659986c944ac99 100644 (file)
@@ -54,18 +54,6 @@ public class EmailSettingsTest {
     assertThat(underTest.getServerBaseURL()).isEqualTo(expected);
   }
 
-  @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);