Don't show "[]" when there are no labels in !ghissue

This commit is contained in:
jesopo 2019-03-02 21:14:51 +00:00
parent 91a7f622b8
commit a063f54a38

View file

@ -109,11 +109,15 @@ class Module(ModuleManager.BaseModule):
def _gh_issue(self, event, page, username, repository, number): def _gh_issue(self, event, page, username, repository, number):
labels = [label["name"] for label in page.data["labels"]] labels = [label["name"] for label in page.data["labels"]]
labels_str = ""
if labels:
labels_str = "[%s] " % ", ".join(labels)
url = self._short_url(page.data["html_url"]) url = self._short_url(page.data["html_url"])
event["stdout"].write("(%s/%s issue#%s, %s) %s [%s] %s" % ( event["stdout"].write("(%s/%s issue#%s, %s) %s %s%s" % (
username, repository, number, page.data["state"], username, repository, number, page.data["state"],
page.data["title"], ", ".join(labels), url)) page.data["title"], labels_str, url))
def _gh_get_issue(self, username, repository, number): def _gh_get_issue(self, username, repository, number):
return utils.http.request( return utils.http.request(
API_ISSUE_URL % (username, repository, number), API_ISSUE_URL % (username, repository, number),