Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/integrations/base_chat_notification.rb')
-rw-r--r--app/models/integrations/base_chat_notification.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/app/models/integrations/base_chat_notification.rb b/app/models/integrations/base_chat_notification.rb
index 2c929dc2cb3..b75801335bd 100644
--- a/app/models/integrations/base_chat_notification.rb
+++ b/app/models/integrations/base_chat_notification.rb
@@ -13,6 +13,8 @@ module Integrations
tag_push pipeline wiki_page deployment incident
].freeze
+ GROUP_ONLY_SUPPORTED_EVENTS = %w[group_mention group_confidential_mention].freeze
+
SUPPORTED_EVENTS_FOR_LABEL_FILTER = %w[issue confidential_issue merge_request note confidential_note].freeze
EVENT_CHANNEL = proc { |event| "#{event}_channel" }
@@ -26,12 +28,12 @@ module Integrations
attribute :category, default: 'chat'
- prop_accessor :webhook, :username, :channel, :branches_to_be_notified, :labels_to_be_notified, :labels_to_be_notified_behavior
+ prop_accessor :webhook, :username, :channel, :branches_to_be_notified, :labels_to_be_notified,
+ :labels_to_be_notified_behavior, :notify_only_default_branch
# Custom serialized properties initialization
prop_accessor(*SUPPORTED_EVENTS.map { |event| EVENT_CHANNEL[event] })
-
- boolean_accessor :notify_only_default_branch
+ prop_accessor(*GROUP_ONLY_SUPPORTED_EVENTS.map { |event| EVENT_CHANNEL[event] })
validates :webhook,
presence: true,
@@ -44,10 +46,10 @@ module Integrations
super
if properties.empty?
- self.notify_only_broken_pipelines = true if self.respond_to?(:notify_only_broken_pipelines)
+ self.notify_only_broken_pipelines = true if respond_to?(:notify_only_broken_pipelines)
self.branches_to_be_notified = "default"
self.labels_to_be_notified_behavior = MATCH_ANY_LABEL
- elsif !self.notify_only_default_branch.nil?
+ elsif !notify_only_default_branch.nil?
# In older versions, there was only a boolean property named
# `notify_only_default_branch`. Now we have a string property named
# `branches_to_be_notified`. Instead of doing a background migration, we
@@ -55,7 +57,7 @@ module Integrations
# users haven't specified one already. When users edit the integration and
# select a value for this new property, it will override everything.
- self.branches_to_be_notified ||= notify_only_default_branch? ? "default" : "all"
+ self.branches_to_be_notified ||= notify_only_default_branch == 'true' ? "default" : "all"
end
end
@@ -237,7 +239,7 @@ module Integrations
case object_kind
when "push", "tag_push"
Integrations::ChatMessage::PushMessage.new(data) if notify_for_ref?(data)
- when "issue"
+ when "issue", "incident"
Integrations::ChatMessage::IssueMessage.new(data) unless update?(data)
when "merge_request"
Integrations::ChatMessage::MergeMessage.new(data) unless update?(data)
@@ -249,8 +251,8 @@ module Integrations
Integrations::ChatMessage::WikiPageMessage.new(data)
when "deployment"
Integrations::ChatMessage::DeploymentMessage.new(data) if notify_for_ref?(data)
- when "incident"
- Integrations::ChatMessage::IssueMessage.new(data) unless update?(data)
+ when "group_mention"
+ Integrations::ChatMessage::GroupMentionMessage.new(data)
end
end
# rubocop:enable Metrics/CyclomaticComplexity