summaryrefslogtreecommitdiff
path: root/app/models/notification.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/notification.rb')
-rw-r--r--app/models/notification.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/app/models/notification.rb b/app/models/notification.rb
new file mode 100644
index 00000000000..bfd1e2cff56
--- /dev/null
+++ b/app/models/notification.rb
@@ -0,0 +1,30 @@
+class Notification
+ #
+ # Notification levels
+ #
+ N_DISABLED = 0
+ N_PARTICIPATING = 1
+ N_WATCH = 2
+
+ attr_accessor :user
+
+ def self.notification_levels
+ [N_DISABLED, N_PARTICIPATING, N_WATCH]
+ end
+
+ def initialize(user)
+ @user = user
+ end
+
+ def disabled?
+ user.notification_level == N_DISABLED
+ end
+
+ def participating?
+ user.notification_level == N_PARTICIPATING
+ end
+
+ def watch?
+ user.notification_level == N_WATCH
+ end
+end