diff --git a/app/models/message.rb b/app/models/message.rb index dec6fb492..f4f75bffe 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -59,13 +59,10 @@ class Message < ActiveRecord::Base self.conversation = parent end - def after_receive(user, person) + def increase_unread(user) if vis = ConversationVisibility.where(:conversation_id => self.conversation_id, :person_id => user.person.id).first vis.unread += 1 vis.save - self - else - raise NotVisibleError.new("User #{user.id} with person #{user.person.id} is not allowed to see conversation #{conversation.id}!") end end diff --git a/app/models/notifications/private_message.rb b/app/models/notifications/private_message.rb index 6a064ffb9..27f0197d9 100644 --- a/app/models/notifications/private_message.rb +++ b/app/models/notifications/private_message.rb @@ -8,7 +8,7 @@ class Notifications::PrivateMessage < Notification def self.make_notification(recipient, target, actor, notification_type) n = notification_type.new(:target => target, :recipient_id => recipient.id) - + target.increase_unread(recipient) n.actors << actor n end