Skip to content

Commit

Permalink
Include custom message when changes are found
Browse files Browse the repository at this point in the history
  • Loading branch information
philowest committed Jun 2, 2015
1 parent 2e7851f commit 1c03317
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/java/jenkins/plugins/slack/ActiveNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void started(AbstractBuild build) {
}
}

String changes = getChanges(build);
String changes = getChanges(build, notifier.includeCustomMessage());
if (changes != null) {
notifyStart(build, changes);
} else {
Expand Down Expand Up @@ -110,7 +110,7 @@ public void completed(AbstractBuild r) {
}
}

String getChanges(AbstractBuild r) {
String getChanges(AbstractBuild r, boolean includeCustomMessage) {
if (!r.hasChangeSetComputed()) {
logger.info("No change set computed...");
return null;
Expand Down Expand Up @@ -138,7 +138,11 @@ String getChanges(AbstractBuild r) {
message.append(" (");
message.append(files.size());
message.append(" file(s) changed)");
return message.appendOpenLink().toString();
message.appendOpenLink();
if (includeCustomMessage) {
message.appendCustomMessage();
}
return message.toString();
}

String getCommitList(AbstractBuild r) {
Expand Down Expand Up @@ -296,7 +300,6 @@ public MessageBuilder appendTestSummary() {
}

public MessageBuilder appendCustomMessage() {
AbstractProject<?, ?> project = build.getProject();
String customMessage = notifier.getCustomMessage();
EnvVars envVars = new EnvVars();
try {
Expand Down

0 comments on commit 1c03317

Please sign in to comment.