Browse Source

SONAR-5970 Have tag changes appear in email notification

tags/latest-silver-master-#65
Jean-Baptiste Lievremont 9 years ago
parent
commit
a9ffa9b075

+ 9
- 0
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplate.java View File

@@ -82,6 +82,15 @@ public class IssueChangesEmailTemplate extends EmailTemplate {
appendField(sb, "Message", notif.getFieldValue("old.message"), notif.getFieldValue("new.message"));
appendField(sb, "Author", notif.getFieldValue("old.author"), notif.getFieldValue("new.author"));
appendFieldWithoutHistory(sb, "Action Plan", notif.getFieldValue("old.actionPlan"), notif.getFieldValue("new.actionPlan"));
appendField(sb, "Tags", formatTagChange(notif.getFieldValue("old.tags")), formatTagChange(notif.getFieldValue("new.tags")));
}

private static String formatTagChange(String tags) {
if (tags == null) {
return null;
} else {
return "[" + tags + "]";
}
}

private void appendHeader(Notification notif, StringBuilder sb) {

+ 2
- 1
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest.java View File

@@ -124,7 +124,8 @@ public class IssueChangesEmailTemplateTest {
.setFieldValue("old.assignee", "simon")
.setFieldValue("new.assignee", "louis")
.setFieldValue("new.resolution", "FALSE-POSITIVE")
.setFieldValue("new.status", "RESOLVED");
.setFieldValue("new.status", "RESOLVED")
.setFieldValue("new.tags", "bug performance");

EmailMessage email = template.format(notification);
assertThat(email.getMessageId()).isEqualTo("issue-changes/ABCDE");

+ 1
- 0
plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest/email_with_multiple_changes.txt View File

@@ -6,5 +6,6 @@ Comment: How to fix it?
Assignee changed to louis
Resolution: FALSE-POSITIVE
Status: RESOLVED
Tags: [bug performance]

See it in SonarQube: http://nemo.sonarsource.org/issues/search#issues=ABCDE

Loading…
Cancel
Save