Bug #693 » 0003-fixes-notifications-allways-being-sent-to-all-users.patch
app/models/notice.rb | ||
---|---|---|
validates_inclusion_of :level, :in => TYPES
|
||
validates_presence_of :content
|
||
before_save :add_to_all_users
|
||
before_save :add_to_users
|
||
def to_s
|
||
"#{global? ? "global" : "individual"} #{content}"
|
||
... | ... | |
end
|
||
private
|
||
def add_to_all_users
|
||
self.users = User.all
|
||
def add_to_users
|
||
if global
|
||
self.users = User.all
|
||
else
|
||
self.users = [User.current]
|
||
end
|
||
end
|
||
def set_default_notice_level
|