aboutsummaryrefslogtreecommitdiff
path: root/modules/git_webhooks/__init__.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-10-28 14:10:42 +0000
committerGravatar jesopo2019-10-28 14:10:42 +0000
commit7766c889f460a427cd1f3fe5711c32fe2a2bee56 (patch)
tree4b7a214ce833b45c6081e19520c3e308a272e40b /modules/git_webhooks/__init__.py
parentfix relay exception (diff)
signature
support event 'category' for GitLab (e.g. Note events but only for Issues)
Diffstat (limited to 'modules/git_webhooks/__init__.py')
-rw-r--r--modules/git_webhooks/__init__.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/modules/git_webhooks/__init__.py b/modules/git_webhooks/__init__.py
index 7a1154fb..c847866e 100644
--- a/modules/git_webhooks/__init__.py
+++ b/modules/git_webhooks/__init__.py
@@ -67,7 +67,7 @@ class Module(ModuleManager.BaseModule):
organisation_lower = (organisation or "").lower()
branch = handler.branch(data, headers)
- current_event, event_action = handler.event(data, headers)
+ current_events = handler.event(data, headers)
unfiltered_targets = []
if "channels" in params:
@@ -101,13 +101,12 @@ class Module(ModuleManager.BaseModule):
not branch in hook["branches"]):
continue
- events = []
+ hooked_events = []
for hooked_event in hook["events"]:
- events.append(handler.event_categories(hooked_event))
- events = list(itertools.chain(*events))
+ hooked_events.append(handler.event_categories(hooked_event))
+ hooked_events = set(itertools.chain(*hooked_events))
- if (current_event in events or
- (event_action and event_action in events)):
+ if bool(set(current_events)&set(hooked_events)):
targets.append([server, channel])
if not targets: