MergeRequest Notes do not have an "issue" item

This commit is contained in:
jesopo 2020-01-27 15:14:09 +00:00
parent 4cffeae132
commit 2bf277bbfc

View file

@ -189,17 +189,18 @@ class GitLab(object):
def note(self, full_name, data): def note(self, full_name, data):
type = data["object_attributes"]["noteable_type"] type = data["object_attributes"]["noteable_type"]
if type in ["Issue", "MergeRequest"]: if type == "Issue":
return self.issue_note(full_name, data) 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): def _note(self, full_name, data, type):
number = utils.irc.color("#%s" % data["issue"]["iid"], number = utils.irc.color("#%s" % type["iid"], colors.COLOR_ID)
colors.COLOR_ID)
type = data["object_attributes"]["noteable_type"] type = data["object_attributes"]["noteable_type"]
type == "issue" if type == "Issue" else "MR" type == "issue" if type == "Issue" else "MR"
issue_title = data["issue"]["title"] title = object["title"]
commenter = utils.irc.bold(data["user"]["username"]) commenter = utils.irc.bold(data["user"]["username"])
url = data["object_attributes"]["url"] url = data["object_attributes"]["url"]
return [["[%s] %s commented on %s: %s" % return [["[%s] %s commented on %s: %s" %
(type, commenter, number, issue_title), url]] (type, commenter, number, title), url]]