Add a setting to hide github repo names

This commit is contained in:
jesopo 2019-03-01 21:20:19 +00:00
parent 43eda14267
commit 88a28352b8

View file

@ -83,6 +83,9 @@ CHECK_RUN_FAILURES = ["failure", "cancelled", "timed_out", "action_required"]
@utils.export("channelset", {"setting": "github-hide-prefix", @utils.export("channelset", {"setting": "github-hide-prefix",
"help": "Hide/show command-like prefix on Github hook outputs", "help": "Hide/show command-like prefix on Github hook outputs",
"validate": utils.bool_or_none}) "validate": utils.bool_or_none})
@utils.export("channelset", {"setting": "github-hide-organisation",
"help": "Hide/show organisation in repository names",
"validate": utils.bool_or_none})
@utils.export("channelset", {"setting": "github-default-repo", @utils.export("channelset", {"setting": "github-default-repo",
"help": "Set the default github repo for the current channel"}) "help": "Set the default github repo for the current channel"})
@utils.export("channelset", {"setting": "github-prevent-highlight", @utils.export("channelset", {"setting": "github-prevent-highlight",
@ -365,10 +368,15 @@ class Module(ModuleManager.BaseModule):
elif github_event == "watch": elif github_event == "watch":
outputs = self.watch(data) outputs = self.watch(data)
source = full_name or organisation
hide_org = event["channel"].get_setting("github-hide-organisation",
False)
if repo_name and hide_org:
source = repo_name
if outputs: if outputs:
for server, channel in targets: for server, channel in targets:
for output in outputs: for output in outputs:
source = full_name or organisation
output = "(%s) %s" % ( output = "(%s) %s" % (
utils.irc.color(source, COLOR_REPO), output) utils.irc.color(source, COLOR_REPO), output)