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

View file

@ -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.send_comment object if (object.is_a?(Comment) && self.owns?( object.post))
object.person.dispatch_comment object if (object.is_a?(Comment)
end
end