fixed comment notifications / dispatching

This commit is contained in:
danielgrippi 2011-09-15 14:25:15 -07:00
parent 97f80272b2
commit 70deed01e1
3 changed files with 17 additions and 3 deletions

View file

@ -43,7 +43,7 @@ module Diaspora
end
end
def receive(user, person)
def receive(user, person=nil)
self.class.transaction do
comment_or_like = self.class.where(:guid => self.guid).first || self

View file

@ -10,13 +10,27 @@ module Postzord
end
def perform!
create_visibilities unless @object.respond_to?(:relayable?)
if @object.respond_to?(:relayable?)
receive_relayable
else
create_visibilities
end
notify_mentioned_users if @object.respond_to?(:mentions)
socket_to_users if @object.respond_to?(:socket_to_user)
notify_users
end
# NOTE(copied over from receiver public)
# @return [Object]
def receive_relayable
if @object.parent.author.local?
# receive relayable object only for the owner of the parent object
@object.receive(@object.parent.author.owner)
end
@object
end
# Batch import visibilities for the recipients of the given @object
# @note performs a bulk insert into mySQL
# @return [void]

View file

@ -33,7 +33,7 @@ module Postzord
def receive_relayable
if @object.parent.author.local?
# receive relayable object only for the owner of the parent object
@object.receive(@object.parent.author.user, @author)
@object.receive(@object.parent.author.owner, @author)
end
# notify everyone who can see the parent object
receiver = Postzord::Receiver::LocalPostBatch.new(@object, self.recipient_user_ids)