From c4daaf5a57c2e2e9245a7189b730a9833953d602 Mon Sep 17 00:00:00 2001 From: sgaland Date: Fri, 21 Aug 2015 10:54:06 -0700 Subject: [PATCH] Only show KO on Slack if relevant In order to improve the visibility on Slack only show the KO keyword is there is an actual KO on the PR. Do not show the KO count because one is enough to block the PR. --- bot/tasks.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bot/tasks.py b/bot/tasks.py index 7c0a7eb..5dc6f07 100644 --- a/bot/tasks.py +++ b/bot/tasks.py @@ -46,11 +46,14 @@ def slack(url, org, weburl, repos, slackurl, channel): txt += " *%s* -" % (pr.milestone) for label in pr.labels: txt += " *%s* -" % (label['name']) - txt += " %s review:%d %s:%d %s:%d %s:%d\n" % \ + txt += " %s review:%d %s:%d %s:%d" % \ (pr.user, pr.nbreview, settings.FEEDBACK_OK['keyword'], pr.feedback_ok, - settings.FEEDBACK_WEAK['keyword'], pr.feedback_weak, - settings.FEEDBACK_KO['keyword'], pr.feedback_ko) + settings.FEEDBACK_WEAK['keyword'], pr.feedback_weak) + if pr.feedback_ko > 0: + txt += " %s" % (settings.FEEDBACK_KO['keyword']) + txt += "\n" + payload = {"channel": channel,