wip
This commit is contained in:
parent
5258a37ce5
commit
dd1b869705
3 changed files with 10 additions and 2 deletions
|
|
@ -35,10 +35,14 @@ module Diaspora
|
||||||
self.parent.subscribers(user)
|
self.parent.subscribers(user)
|
||||||
elsif user.owns?(self)
|
elsif user.owns?(self)
|
||||||
[self.parent.author]
|
[self.parent.author]
|
||||||
|
else
|
||||||
|
raise "What are you doing with a relayable that you have nothing to do with?"
|
||||||
|
#[]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def receive(user, person)
|
def receive(user, person)
|
||||||
|
|
||||||
self.class.transaction do
|
self.class.transaction do
|
||||||
comment_or_like = self.class.where(:guid => self.guid).first || self
|
comment_or_like = self.class.where(:guid => self.guid).first || self
|
||||||
|
|
||||||
|
|
@ -57,11 +61,14 @@ module Diaspora
|
||||||
|
|
||||||
#dispatch object DOWNSTREAM, received it via UPSTREAM
|
#dispatch object DOWNSTREAM, received it via UPSTREAM
|
||||||
unless user.owns?(comment_or_like)
|
unless user.owns?(comment_or_like)
|
||||||
comment_or_like.save
|
puts "i am #{user.username}, I am reiveiving and object for #{person.owner.username}"
|
||||||
|
pp self
|
||||||
|
comment_or_like.save!
|
||||||
Postzord::Dispatcher.new(user, comment_or_like).post
|
Postzord::Dispatcher.new(user, comment_or_like).post
|
||||||
end
|
end
|
||||||
|
|
||||||
comment_or_like.socket_to_user(user) if comment_or_like.respond_to? :socket_to_user
|
comment_or_like.socket_to_user(user) if comment_or_like.respond_to? :socket_to_user
|
||||||
|
|
||||||
if comment_or_like.after_receive(user, person)
|
if comment_or_like.after_receive(user, person)
|
||||||
comment_or_like
|
comment_or_like
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,5 @@ class Postzord::Dispatcher
|
||||||
@zord = Postzord::Dispatcher::Private.new(user, object, opts)
|
@zord = Postzord::Dispatcher::Private.new(user, object, opts)
|
||||||
#end
|
#end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ module Postzord
|
||||||
Rails.logger.info("event=receive status=start recipient=#{@user_person.diaspora_handle} payload_type=#{@object.class} sender=#{@sender.diaspora_handle}")
|
Rails.logger.info("event=receive status=start recipient=#{@user_person.diaspora_handle} payload_type=#{@object.class} sender=#{@sender.diaspora_handle}")
|
||||||
if self.validate_object
|
if self.validate_object
|
||||||
receive_object
|
receive_object
|
||||||
|
else
|
||||||
|
raise 'not a valid object'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue