summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Chao <mchao@gitlab.com>2018-07-30 18:30:36 +0800
committerMark Chao <mchao@gitlab.com>2018-08-14 17:30:40 +0800
commitbf88e9afe70e6589dd0c1c089a5a73c8d2b687c6 (patch)
tree1eb94a282c2d10b78a42ac23493513499b06b847
parent59564df15f5fc0893fcd09cfb00d8c8e6534696d (diff)
downloadgitlab-ce-bf88e9afe70e6589dd0c1c089a5a73c8d2b687c6.tar.gz
Allow extensible mention type action for EE
-rw-r--r--app/services/notification_recipient_service.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb
index 1172fdbea8d..5c0e8a35cb0 100644
--- a/app/services/notification_recipient_service.rb
+++ b/app/services/notification_recipient_service.rb
@@ -220,6 +220,8 @@ module NotificationRecipientService
end
class Default < Base
+ MENTION_TYPE_ACTIONS = [:new_issue, :new_merge_request].freeze
+
attr_reader :target
attr_reader :current_user
attr_reader :action
@@ -252,7 +254,7 @@ module NotificationRecipientService
add_subscribed_users
- if [:new_issue, :new_merge_request].include?(custom_action)
+ if self.class.mention_type_actions.include?(custom_action)
# These will all be participants as well, but adding with the :mention
# type ensures that users with the mention notification level will
# receive them, too.
@@ -283,6 +285,10 @@ module NotificationRecipientService
def custom_action
@custom_action ||= "#{action}_#{target.class.model_name.name.underscore}".to_sym
end
+
+ def self.mention_type_actions
+ MENTION_TYPE_ACTIONS.dup
+ end
end
class NewNote < Base