summaryrefslogtreecommitdiff
path: root/app/models/notification_setting.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-03-28 18:17:42 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-03-30 10:44:20 +0200
commit359157c097993a9b917ca590e128e85cf358d95d (patch)
tree08a29f8221442621506f38fa8dce7095d630f7d0 /app/models/notification_setting.rb
parent73c5a3410596165244bfa3d2f657c313ec1c558c (diff)
downloadgitlab-ce-359157c097993a9b917ca590e128e85cf358d95d.tar.gz
Introduce NotificationSetting to user interface
* visiting project will create notification setting if missing * change notification setting per project even without membership * use notification settings instead of membership on profile page Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/notification_setting.rb')
-rw-r--r--app/models/notification_setting.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rb
index 0dce146b7a9..287862a01bc 100644
--- a/app/models/notification_setting.rb
+++ b/app/models/notification_setting.rb
@@ -11,4 +11,11 @@ class NotificationSetting < ActiveRecord::Base
# Notification level
# Note: When adding an option, it MUST go on the end of the array.
enum level: [:disabled, :participating, :watch, :global, :mention]
+
+ scope :for_groups, -> { where(source_type: 'Namespace') }
+ scope :for_projects, -> { where(source_type: 'Project') }
+
+ def set_defaults
+ self.level = :global
+ end
end