summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Chao <mchao@gitlab.com>2018-07-23 20:51:42 +0800
committerMark Chao <mchao@gitlab.com>2018-07-24 11:16:28 +0800
commit96dc823c8987f87046e3d24b6e704b528d7e2d30 (patch)
tree9670ccbd9fd87e3919e01cc612ca5fff2a644f75
parent93b9deca8c87b250cf5eaebe1827efc89b170677 (diff)
downloadgitlab-ce-ee-5863-customize-notifications-for-new-epic.tar.gz
Allow global event list containing all eventsee-5863-customize-notifications-for-new-epic
This way we can globally set group only ee events too. Use nil to indicate global.
-rw-r--r--lib/api/notification_settings.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/api/notification_settings.rb b/lib/api/notification_settings.rb
index f0f49253004..34e93b6db8b 100644
--- a/lib/api/notification_settings.rb
+++ b/lib/api/notification_settings.rb
@@ -50,7 +50,9 @@ module API
end
end
- %w[group project].each do |source_type|
+ [Group, Project].each do |source_class|
+ source_type = source_class.name.underscore
+
params do
requires :id, type: String, desc: "The #{source_type} ID"
end
@@ -73,7 +75,7 @@ module API
end
params do
optional :level, type: String, desc: "The #{source_type} notification level"
- NotificationSetting.email_events_for(source_type.to_sym).each do |event|
+ NotificationSetting.email_events_for(source_class).each do |event|
optional event, type: Boolean, desc: 'Enable/disable this notification'
end
end