MS IZ testing on remote
This commit is contained in:
parent
c3e199a00a
commit
3ed191e972
2 changed files with 34 additions and 3 deletions
|
|
@ -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
|
||||||
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
|
||||||
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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue