summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMark Chao <mchao@gitlab.com>2018-07-23 10:42:19 +0800
committerMark Chao <mchao@gitlab.com>2018-08-14 14:59:29 +0800
commit8411d1cffc05171e82d727d883f03e279c8e9e05 (patch)
treeb09d87417123465509e43306dbba0da3d2abf640 /lib
parentbea52d827e895c9261b3b1e01980832832f7c82a (diff)
downloadgitlab-ce-8411d1cffc05171e82d727d883f03e279c8e9e05.tar.gz
Add email_events to replace EMAIL_EVENTS because it needs to be dynamic,
allowing override for EE.
Diffstat (limited to 'lib')
-rw-r--r--lib/api/entities.rb2
-rw-r--r--lib/api/notification_settings.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 27f28e1df93..453ebb9c669 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -856,7 +856,7 @@ module API
class NotificationSetting < Grape::Entity
expose :level
expose :events, if: ->(notification_setting, _) { notification_setting.custom? } do
- ::NotificationSetting::EMAIL_EVENTS.each do |event|
+ ::NotificationSetting.email_events.each do |event|
expose event
end
end
diff --git a/lib/api/notification_settings.rb b/lib/api/notification_settings.rb
index 0266bf2f717..9c824d9953c 100644
--- a/lib/api/notification_settings.rb
+++ b/lib/api/notification_settings.rb
@@ -23,7 +23,7 @@ module API
params do
optional :level, type: String, desc: 'The global notification level'
optional :notification_email, type: String, desc: 'The email address to send notifications'
- NotificationSetting::EMAIL_EVENTS.each do |event|
+ NotificationSetting.email_events.each do |event|
optional event, type: Boolean, desc: 'Enable/disable this notification'
end
end
@@ -73,7 +73,7 @@ module API
end
params do
optional :level, type: String, desc: "The #{source_type} notification level"
- NotificationSetting::EMAIL_EVENTS.each do |event|
+ NotificationSetting.email_events(source_type.to_sym).each do |event|
optional event, type: Boolean, desc: 'Enable/disable this notification'
end
end