diff --git a/app/models/person.rb b/app/models/person.rb index 7e0c2d3bb..9a0723233 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -66,7 +66,14 @@ class Person raise "must comment on something!" unless options[:on] c = Comment.new(:person_id => self.id, :text => text, :post => options[:on]) if c.save + begin dispatch_comment c + rescue Exception => e + puts e.inspect + raise e + end + + c.socket_to_uid owner.id if owner_id true else @@ -77,7 +84,7 @@ class Person def dispatch_comment( c ) if owns? c.post - push_downstream + c.push_downstream elsif owns? c c.push_upstream end diff --git a/app/models/user.rb b/app/models/user.rb index d20c48bdb..16a58862e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -174,7 +174,7 @@ class User Rails.logger.debug("Saving object: #{object}") object.save object.socket_to_uid( id) if (object.respond_to?(:socket_to_uid) && !self.owns?(object)) - object.person.dispatch_comment object if object.is_a?(Comment) + dispatch_comment object if object.is_a?(Comment) && !owns?(object) end end diff --git a/db/seeds/tom.rb b/db/seeds/tom.rb index d3aa7289b..c8b1d41a6 100644 --- a/db/seeds/tom.rb +++ b/db/seeds/tom.rb @@ -1,23 +1,24 @@ require 'config/environment' +remote_url = "http://tom.joindiaspora.com/" # Create seed user -user = User.create( :email => "tom@tom.joindiaspora.com", +user = User.create!( :email => "tom@tom.joindiaspora.com", :password => "evankorth", :person => Person.new( :email => "tom@tom.joindiaspora.com", - :url => "http://tom.joindiaspora.com/", + :url => remote_url, :profile => Profile.new( :first_name => "Alexander", :last_name => "Hamiltom" )) ) -user.person.save +user.person.save! -user2 = User.create( :email => "korth@tom.joindiaspora.com", +user2 = User.create!( :email => "korth@tom.joindiaspora.com", :password => "evankorth", :person => Person.new( :email => "korth@tom.joindiaspora.com", - :url => "http://tom.joindiaspora.com/", + :url => remote_url, :profile => Profile.new( :first_name => "Evan", :last_name => "Korth"))) -user2.person.save +user2.person.save! # friending users group = user.group(:name => "other dudes") diff --git a/lib/diaspora/websocket.rb b/lib/diaspora/websocket.rb index fcdcc9744..bfbc69c26 100644 --- a/lib/diaspora/websocket.rb +++ b/lib/diaspora/websocket.rb @@ -21,7 +21,7 @@ module Diaspora end def self.unsubscribe(uid,sid) - Rails.logger.debug "Unsubscribing socket #{sid} from #{User.first(:id => uid).email}" + Rails.logger.debug "Unsubscribing socket #{sid} from #{uid}" @channels[uid][0].unsubscribe(sid) if @channels[uid] @channels[uid][1] -= 1 if @channels[uid][1] <= 0