Skip to content

Commit

Permalink
Send only one message with commit list.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenji21 authored and timja committed Dec 17, 2018
1 parent 72d41da commit f56cef4
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/main/java/jenkins/plugins/slack/ActiveNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,12 @@ public void finalized(AbstractBuild r) {
} while (previousBuild != null && previousBuild.getResult() == Result.ABORTED);
Result previousResult = (previousBuild != null) ? previousBuild.getResult() : Result.SUCCESS;
if(null != previousResult && (result.isWorseThan(previousResult) || moreTestFailuresThanPreviousBuild(r, previousBuild)) && notifier.getNotifyRegression()) {
getSlack(r).publish(getBuildStatusMessage(r, notifier.getIncludeTestSummary(),
notifier.getIncludeFailedTests(), notifier.getIncludeCustomMessage()), getBuildColor(r));
String message = getBuildStatusMessage(r, notifier.getIncludeTestSummary(),
notifier.getIncludeFailedTests(), notifier.getIncludeCustomMessage());
if (notifier.getCommitInfoChoice().showAnything()) {
getSlack(r).publish(getCommitList(r), getBuildColor(r));
}
message = message + "\n" + getCommitList(r);
}
getSlack(r).publish(message, getBuildColor(r));
}
}
}
Expand All @@ -141,11 +142,12 @@ public void completed(AbstractBuild r) {
&& notifier.getNotifyBackToNormal())
|| (result == Result.SUCCESS && notifier.getNotifySuccess())
|| (result == Result.UNSTABLE && notifier.getNotifyUnstable())) {
getSlack(r).publish(getBuildStatusMessage(r, notifier.getIncludeTestSummary(),
notifier.getIncludeFailedTests(), notifier.getIncludeCustomMessage()), getBuildColor(r));
String message = getBuildStatusMessage(r, notifier.getIncludeTestSummary(),
notifier.getIncludeFailedTests(), notifier.getIncludeCustomMessage());
if (notifier.getCommitInfoChoice().showAnything()) {
getSlack(r).publish(getCommitList(r), getBuildColor(r));
message = message + "\n" + getCommitList(r);
}
getSlack(r).publish(message, getBuildColor(r));
}
}
}
Expand Down

0 comments on commit f56cef4

Please sign in to comment.