Skip to content
Extraits de code Groupes Projets
Valider 007b4e4f rédigé par danielvincent's avatar danielvincent
Parcourir les fichiers

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

parents 81438678 36342db7
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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
......
......@@ -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
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter