Fix notifications for private messages between local users, fixes #2321
This commit is contained in:
parent
7517c29ed0
commit
6cf6f1dd7d
2 changed files with 2 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue