diff options
author | Maxwell Salzberg <maxwell@joindiaspora.com> | 2011-09-13 07:29:18 +0400 |
---|---|---|
committer | Maxwell Salzberg <maxwell@joindiaspora.com> | 2011-09-14 00:14:43 +0400 |
commit | dd1b869705d69807571c6267a5803c1a8b82eb9b (patch) | |
tree | 38b2381ace80b88784082f723b3cd99240e01d03 | |
parent | 5258a37ce5cdd03f68349a594ebb0b43a90d0181 (diff) |
wip
-rw-r--r-- | lib/diaspora/relayable.rb | 9 | ||||
-rw-r--r-- | lib/postzord/dispatcher.rb | 1 | ||||
-rw-r--r-- | lib/postzord/receiver/private.rb | 2 |
3 files changed, 10 insertions, 2 deletions
diff --git a/lib/diaspora/relayable.rb b/lib/diaspora/relayable.rb index d5b85263a..cc80a3001 100644 --- a/lib/diaspora/relayable.rb +++ b/lib/diaspora/relayable.rb @@ -35,10 +35,14 @@ module Diaspora self.parent.subscribers(user) elsif user.owns?(self) [self.parent.author] + else + raise "What are you doing with a relayable that you have nothing to do with?" + #[] end end def receive(user, person) + self.class.transaction do comment_or_like = self.class.where(:guid => self.guid).first || self @@ -57,11 +61,14 @@ module Diaspora #dispatch object DOWNSTREAM, received it via UPSTREAM 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 end comment_or_like.socket_to_user(user) if comment_or_like.respond_to? :socket_to_user + if comment_or_like.after_receive(user, person) comment_or_like end diff --git a/lib/postzord/dispatcher.rb b/lib/postzord/dispatcher.rb index d1178258d..7b3c5255b 100644 --- a/lib/postzord/dispatcher.rb +++ b/lib/postzord/dispatcher.rb @@ -21,6 +21,5 @@ class Postzord::Dispatcher @zord = Postzord::Dispatcher::Private.new(user, object, opts) #end end - end diff --git a/lib/postzord/receiver/private.rb b/lib/postzord/receiver/private.rb index 18ba4dfb9..521be7b79 100644 --- a/lib/postzord/receiver/private.rb +++ b/lib/postzord/receiver/private.rb @@ -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}") if self.validate_object receive_object + else + raise 'not a valid object' end end |