Commit 6cf6f1dd authored by Jason Robinson's avatar Jason Robinson

Fix notifications for private messages between local users, fixes #2321

parent 7517c29e
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment