From 2bf277bbfc43d96c92df8d4e27f1e8a4af0165a8 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 27 Jan 2020 15:14:09 +0000 Subject: MergeRequest Notes do not have an "issue" item --- modules/git_webhooks/gitlab.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'modules/git_webhooks') diff --git a/modules/git_webhooks/gitlab.py b/modules/git_webhooks/gitlab.py index 3a2e0fc4..adc6246f 100644 --- a/modules/git_webhooks/gitlab.py +++ b/modules/git_webhooks/gitlab.py @@ -189,17 +189,18 @@ class GitLab(object): def note(self, full_name, data): type = data["object_attributes"]["noteable_type"] - if type in ["Issue", "MergeRequest"]: - return self.issue_note(full_name, data) + if type == "Issue": + self._note(full_name, data, data["issue"]) + elif type == "MergeRequest": + self._note(full_name, data, data["merge_request"]) - def issue_note(self, full_name, data): - number = utils.irc.color("#%s" % data["issue"]["iid"], - colors.COLOR_ID) + def _note(self, full_name, data, type): + number = utils.irc.color("#%s" % type["iid"], colors.COLOR_ID) type = data["object_attributes"]["noteable_type"] type == "issue" if type == "Issue" else "MR" - issue_title = data["issue"]["title"] + title = object["title"] commenter = utils.irc.bold(data["user"]["username"]) url = data["object_attributes"]["url"] return [["[%s] %s commented on %s: %s" % - (type, commenter, number, issue_title), url]] + (type, commenter, number, title), url]] -- cgit v1.3.1-10-gc9f91