Skip to content
Extraits de code Groupes Projets
Valider 3ed191e9 rédigé par Raphael's avatar Raphael
Parcourir les fichiers

MS IZ testing on remote

parent c3e199a0
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -166,6 +166,7 @@ class User ...@@ -166,6 +166,7 @@ class User
object = Diaspora::Parser.from_xml(xml) object = Diaspora::Parser.from_xml(xml)
Rails.logger.debug("Receiving object:\n#{object.inspect}") Rails.logger.debug("Receiving object:\n#{object.inspect}")
Rails.logger.debug("From: #{object.person.inspect}") if object.person 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? 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.is_a? Retraction
if object.type == 'Person' && object.signature_valid? if object.type == 'Person' && object.signature_valid?
...@@ -195,9 +196,6 @@ class User ...@@ -195,9 +196,6 @@ class User
person.save person.save
elsif object.is_a?(Comment) elsif object.is_a?(Comment)
object.person = Diaspora::Parser.parse_or_find_person_from_xml( xml ).save if 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 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
object.save object.save
dispatch_comment object unless owns?(object) dispatch_comment object unless owns?(object)
......
...@@ -133,4 +133,37 @@ describe User do ...@@ -133,4 +133,37 @@ describe User do
Post.count.should be 1 Post.count.should be 1
end end
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 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