diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /app/models/integrations/base_chat_notification.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'app/models/integrations/base_chat_notification.rb')
-rw-r--r-- | app/models/integrations/base_chat_notification.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/integrations/base_chat_notification.rb b/app/models/integrations/base_chat_notification.rb index ca72de47d30..d0d54a92021 100644 --- a/app/models/integrations/base_chat_notification.rb +++ b/app/models/integrations/base_chat_notification.rb @@ -204,7 +204,7 @@ module Integrations when "wiki_page" Integrations::ChatMessage::WikiPageMessage.new(data) when "deployment" - Integrations::ChatMessage::DeploymentMessage.new(data) + Integrations::ChatMessage::DeploymentMessage.new(data) if notify_for_ref?(data) end end @@ -241,7 +241,11 @@ module Integrations def notify_for_ref?(data) return true if data[:object_kind] == 'tag_push' - return true if data.dig(:object_attributes, :tag) + return true if data[:object_kind] == 'deployment' && !Feature.enabled?(:chat_notification_deployment_protected_branch_filter, project) + + ref = data[:ref] || data.dig(:object_attributes, :ref) + return true if ref.blank? # No need to check protected branches when there is no ref + return true if Gitlab::Git.tag_ref?(ref) # Skip protected branch check because it doesn't support tags notify_for_branch?(data) end |