Comments pushing in the right directions
This commit is contained in:
parent
fa2e621b0f
commit
b0537e2f34
4 changed files with 17 additions and 9 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue