Put github-hide-prefix check in all github commands

This commit is contained in:
jesopo 2019-02-27 14:56:20 +00:00
parent 0ed6d05b03
commit f431fdfd16

View file

@ -112,6 +112,10 @@ class Module(ModuleManager.BaseModule):
@utils.hook("received.command.ghissue", min_args=1) @utils.hook("received.command.ghissue", min_args=1)
def github_issue(self, event): def github_issue(self, event):
if event["target"].get_setting("github-hide-prefix", False):
event["stdout"].hide_prefix()
event["stderr"].hide_prefix()
username, repository, number = self._parse_ref( username, repository, number = self._parse_ref(
event["target"], event["args_split"][0]) event["target"], event["args_split"][0])
@ -138,6 +142,10 @@ class Module(ModuleManager.BaseModule):
json=True) json=True)
@utils.hook("received.command.ghpull", min_args=1) @utils.hook("received.command.ghpull", min_args=1)
def github_pull(self, event): def github_pull(self, event):
if event["target"].get_setting("github-hide-prefix", False):
event["stdout"].hide_prefix()
event["stderr"].hide_prefix()
username, repository, number = self._parse_ref( username, repository, number = self._parse_ref(
event["target"], event["args_split"][0]) event["target"], event["args_split"][0])
page = self._gh_get_pull(username, repository, number) page = self._gh_get_pull(username, repository, number)
@ -179,6 +187,10 @@ class Module(ModuleManager.BaseModule):
:usage: events <hook> [category [category ...]] :usage: events <hook> [category [category ...]]
:usage: branches <hook> [branch [branch ...]] :usage: branches <hook> [branch [branch ...]]
""" """
if event["target"].get_setting("github-hide-prefix", False):
event["stdout"].hide_prefix()
event["stderr"].hide_prefix()
all_hooks = event["target"].get_setting("github-hooks", {}) all_hooks = event["target"].get_setting("github-hooks", {})
hook_name = None hook_name = None
existing_hook = None existing_hook = None