From 53de8fd190b4c535de2f95ecdec45aac18698232 Mon Sep 17 00:00:00 2001 From: Joe Fifield Date: Mon, 7 Jul 2014 20:56:42 -0400 Subject: [PATCH] Including previously unstable builds in back to normal notifications --- src/main/java/jenkins/plugins/hipchat/ActiveNotifier.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/jenkins/plugins/hipchat/ActiveNotifier.java b/src/main/java/jenkins/plugins/hipchat/ActiveNotifier.java index 6576ec3..d982e8d 100644 --- a/src/main/java/jenkins/plugins/hipchat/ActiveNotifier.java +++ b/src/main/java/jenkins/plugins/hipchat/ActiveNotifier.java @@ -65,7 +65,7 @@ public void completed(AbstractBuild r) { if ((result == Result.ABORTED && jobProperty.getNotifyAborted()) || (result == Result.FAILURE && jobProperty.getNotifyFailure()) || (result == Result.NOT_BUILT && jobProperty.getNotifyNotBuilt()) - || (result == Result.SUCCESS && previousResult == Result.FAILURE && jobProperty.getNotifyBackToNormal()) + || (result == Result.SUCCESS && (previousResult == Result.FAILURE || previousResult == Result.UNSTABLE) && jobProperty.getNotifyBackToNormal()) || (result == Result.SUCCESS && jobProperty.getNotifySuccess()) || (result == Result.UNSTABLE && jobProperty.getNotifyUnstable())) { getHipChat(r).publish(getBuildStatusMessage(r), getBuildColor(r)); @@ -145,7 +145,7 @@ static String getStatusMessage(AbstractBuild r) { Result result = r.getResult(); Run previousBuild = r.getProject().getLastBuild().getPreviousBuild(); Result previousResult = (previousBuild != null) ? previousBuild.getResult() : Result.SUCCESS; - if (result == Result.SUCCESS && previousResult == Result.FAILURE) return "Back to normal"; + if (result == Result.SUCCESS && (previousResult == Result.FAILURE || previousResult == Result.UNSTABLE)) return "Back to normal"; if (result == Result.SUCCESS) return "Success"; if (result == Result.FAILURE) return "FAILURE"; if (result == Result.ABORTED) return "ABORTED";