diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-03-28 18:17:42 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-03-30 10:44:20 +0200 |
commit | 359157c097993a9b917ca590e128e85cf358d95d (patch) | |
tree | 08a29f8221442621506f38fa8dce7095d630f7d0 /app/models/notification_setting.rb | |
parent | 73c5a3410596165244bfa3d2f657c313ec1c558c (diff) | |
download | gitlab-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.rb | 7 |
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 |