summaryrefslogtreecommitdiff
path: root/app/models/notification.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-02-17 18:06:24 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-02-17 18:06:24 +0200
commit936353edfdf00653b23f6837f29095dbc3a5f5dc (patch)
treea6af1dbf0d899e22ffcc4026c2b7425970e189d4 /app/models/notification.rb
parent0744eac9c61efcba998a5328acf01f80bdfa6e84 (diff)
downloadgitlab-ce-936353edfdf00653b23f6837f29095dbc3a5f5dc.tar.gz
Improve notification settings page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/notification.rb')
-rw-r--r--app/models/notification.rb27
1 files changed, 21 insertions, 6 deletions
diff --git a/app/models/notification.rb b/app/models/notification.rb
index ff6a18d6a51..b0f8ed6a4ec 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -9,12 +9,23 @@ class Notification
attr_accessor :target
- def self.notification_levels
- [N_DISABLED, N_PARTICIPATING, N_WATCH]
- end
-
- def self.project_notification_levels
- [N_DISABLED, N_PARTICIPATING, N_WATCH, N_GLOBAL]
+ class << self
+ def notification_levels
+ [N_DISABLED, N_PARTICIPATING, N_WATCH]
+ end
+
+ def options_with_labels
+ {
+ disabled: N_DISABLED,
+ participating: N_PARTICIPATING,
+ watch: N_WATCH,
+ global: N_GLOBAL
+ }
+ end
+
+ def project_notification_levels
+ [N_DISABLED, N_PARTICIPATING, N_WATCH, N_GLOBAL]
+ end
end
def initialize(target)
@@ -36,4 +47,8 @@ class Notification
def global?
target.notification_level == N_GLOBAL
end
+
+ def level
+ target.notification_level
+ end
end