notification scaffold
This commit is contained in:
parent
5f14a6bcf8
commit
d55ade1686
10 changed files with 119 additions and 7 deletions
30
app/models/notification.rb
Normal file
30
app/models/notification.rb
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue