Merge branch 'master' of github.com:diaspora/diaspora

This commit is contained in:
danielvincent 2010-08-26 17:10:37 -07:00
commit 007b4e4ff0
2 changed files with 35 additions and 1 deletions

View file

@ -166,7 +166,7 @@ class User
object = Diaspora::Parser.from_xml(xml)
Rails.logger.debug("Receiving object:\n#{object.inspect}")
Rails.logger.debug("From: #{object.person.inspect}") if object.person
raise "In receive for #{self.real_name}, signature was not valid on: #{object.inspect}" unless object.signature_valid?
if object.is_a? Retraction
if object.type == 'Person' && object.signature_valid?
@ -196,6 +196,7 @@ class User
elsif object.is_a?(Comment)
object.person = Diaspora::Parser.parse_or_find_person_from_xml( xml ).save if object.person.nil?
Rails.logger.debug("The person parsed from comment xml is #{object.person.inspect}") unless object.person.nil?
object.person.save
Rails.logger.debug("From: #{object.person.inspect}") if object.person
raise "In receive for #{self.real_name}, signature was not valid on: #{object.inspect}" unless object.post.person == self.person || object.verify_post_creator_signature

View file

@ -133,4 +133,37 @@ describe User do
Post.count.should be 1
end
end
describe 'comments' do
it 'should correctly marshal to the downstream user' do
@user3 = Factory.create(:user)
@group3 = @user3.group(:name => 'heroes')
puts @user.inspect
puts @group.inspect
friend_users(@user, @group, @user3, @group3)
status_message = @user.post :status_message, :message => 'store this!', :to => @group.id
@user2.receive status_message.to_diaspora_xml
@user3.receive status_message.to_diaspora_xml
comment = @user2.comment('tada',:on => status_message)
@user.receive comment.to_diaspora_xml
@user.reload
@user.raw_visible_posts.first.comments.first.nil?.should be false
upstream_comment = @user.raw_visible_posts.first.comments.first
@user2.person.delete
@user3.receive upstream_comment.to_diaspora_xml
@user3.reload
@user3.raw_visible_posts.first.comments.first.nil?.should be false
end
end
end