summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Chao <mchao@gitlab.com>2018-07-23 20:51:42 +0800
committerMark Chao <mchao@gitlab.com>2018-08-14 15:03:27 +0800
commite07a1a5bb43f659f5289a7b317a081465945af4d (patch)
tree91b13194787a2b139339ab21a15ecea82f093b00
parent8411d1cffc05171e82d727d883f03e279c8e9e05 (diff)
downloadgitlab-ce-e07a1a5bb43f659f5289a7b317a081465945af4d.tar.gz
Allow global event list containing all events
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 9c824d9953c..bf0d6b9e434 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(source_type.to_sym).each do |event|
+ NotificationSetting.email_events(source_class).each do |event|
optional event, type: Boolean, desc: 'Enable/disable this notification'
end
end