correctly color/phrase opened, closed and merged for MRs

This commit is contained in:
jesopo 2019-10-18 13:31:21 +01:00
parent afd6800c98
commit 2b4f5dc75b

View file

@ -124,8 +124,8 @@ class GitLab(object):
def merge_request(self, full_name, data): def merge_request(self, full_name, data):
number = utils.irc.color("!%s" % data["object_attributes"]["iid"], number = utils.irc.color("!%s" % data["object_attributes"]["iid"],
colors.COLOR_ID) colors.COLOR_ID)
action = ISSUE_ACTIONS[data["object_attributes"]["action"]] action = data["object_attributes"]["action"]
action_desc = "%s %s" % (action, number) action_desc = "%s %s" % (ISSUE_ACTIONS[action], number)
branch = data["object_attributes"]["target_branch"] branch = data["object_attributes"]["target_branch"]
colored_branch = utils.irc.color(branch, colors.COLOR_BRANCH) colored_branch = utils.irc.color(branch, colors.COLOR_BRANCH)
@ -133,13 +133,12 @@ class GitLab(object):
action_desc = "requested %s merge into %s" % (number, action_desc = "requested %s merge into %s" % (number,
colored_branch) colored_branch)
elif action == "close": elif action == "close":
if data["pull_request"]["merged"]: action_desc = "%s %s" % (
utils.irc.color("closed", colors.COLOR_NEGATIVE), number)
elif action == "merge":
action_desc = "%s %s into %s" % ( action_desc = "%s %s into %s" % (
utils.irc.color("merged", colors.COLOR_POSITIVE), number, utils.irc.color("merged", colors.COLOR_POSITIVE), number,
colored_branch) colored_branch)
else:
action_desc = "%s %s" % (
utils.irc.color("closed", colors.COLOR_NEGATIVE), number)
pr_title = data["object_attributes"]["title"] pr_title = data["object_attributes"]["title"]
author = utils.irc.bold(data["user"]["username"]) author = utils.irc.bold(data["user"]["username"])