Rename send_comment to dispatch_comment, simplify it

This commit is contained in:
Raphael 2010-08-16 14:22:14 -07:00
parent 71aaa9240c
commit e4af2ccb1f
2 changed files with 7 additions and 18 deletions

View file

@ -66,7 +66,7 @@ class Person
raise "must comment on something!" unless options[:on] raise "must comment on something!" unless options[:on]
c = Comment.new(:person_id => self.id, :text => text, :post => options[:on]) c = Comment.new(:person_id => self.id, :text => text, :post => options[:on])
if c.save if c.save
send_comment c dispatch_comment c
c.socket_to_uid owner.id if owner_id c.socket_to_uid owner.id if owner_id
true true
else else
@ -75,22 +75,11 @@ class Person
false false
end end
def send_comment( c ) def dispatch_comment( c )
if self.remote? if owns? c.post
if c.post.person.owner.nil? push_downstream
Rails.logger.info "The commenter is not here, and neither is the poster" elsif owns? c
elsif c.post.person.owner c.push_upstream
Rails.logger.info "The commenter is not here, and the poster is"
c.push_downstream
end
else
if owns? c.post
Rails.logger.info "The commenter is here, and is the poster"
c.push_downstream
else
Rails.logger.info "The commenter is here, and is not the poster"
c.push_upstream
end
end end
end end
##profile ##profile

View file

@ -174,7 +174,7 @@ class User
Rails.logger.debug("Saving object: #{object}") Rails.logger.debug("Saving object: #{object}")
object.save object.save
object.socket_to_uid( id) if (object.respond_to?(:socket_to_uid) && !self.owns?(object)) object.socket_to_uid( id) if (object.respond_to?(:socket_to_uid) && !self.owns?(object))
object.person.send_comment object if (object.is_a?(Comment) && self.owns?( object.post)) object.person.dispatch_comment object if (object.is_a?(Comment)
end end
end end