diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-28 15:10:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-28 15:10:10 +0300 |
commit | 22fd199237e247c36de5b982d444cedc194126e6 (patch) | |
tree | 1a5ad68a1dffdf37dfae0d1267bf3bcc04c292cb /app/models/integrations | |
parent | 97b93f6d05b26e57a4d6a6d33a46aacb5f3235a6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/integrations')
-rw-r--r-- | app/models/integrations/base_chat_notification.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/app/models/integrations/base_chat_notification.rb b/app/models/integrations/base_chat_notification.rb index c7ab9befd12..78d7dc60ed9 100644 --- a/app/models/integrations/base_chat_notification.rb +++ b/app/models/integrations/base_chat_notification.rb @@ -108,15 +108,13 @@ module Integrations end def execute(data) - return unless supported_events.include?(data[:object_kind]) - - return unless webhook.present? - object_kind = data[:object_kind] + return false unless should_execute?(object_kind) + data = custom_data(data) - return unless notify_label?(data) + return false unless notify_label?(data) # WebHook events often have an 'update' event that follows a 'open' or # 'close' action. Ignore update events for now to prevent duplicate @@ -182,6 +180,11 @@ module Integrations private + def should_execute?(object_kind) + supported_events.include?(object_kind) && + (!requires_webhook? || webhook.present?) + end + def log_usage(_, _) # Implement in child class end |