RS, IZ; wrote and tested user retractions actually removing people from the friend lists on retractions
This commit is contained in:
parent
1fcb033b68
commit
7bd1193c5e
2 changed files with 20 additions and 4 deletions
|
|
@ -150,7 +150,7 @@ class User
|
||||||
Rails.logger.debug("Receiving object:\n#{object.inspect}")
|
Rails.logger.debug("Receiving object:\n#{object.inspect}")
|
||||||
|
|
||||||
if object.is_a? Retraction
|
if object.is_a? Retraction
|
||||||
object.perform self.id
|
(object.type == 'Person' )? (unfriended_by object.post_id) : (object.perform self.id)
|
||||||
elsif object.is_a? Request
|
elsif object.is_a? Request
|
||||||
person = Diaspora::Parser.get_or_create_person_object_from_xml( xml )
|
person = Diaspora::Parser.get_or_create_person_object_from_xml( xml )
|
||||||
person.serialized_key ||= object.exported_key
|
person.serialized_key ||= object.exported_key
|
||||||
|
|
|
||||||
|
|
@ -130,12 +130,28 @@ describe Diaspora::Parser do
|
||||||
|
|
||||||
it 'should process retraction for a person' do
|
it 'should process retraction for a person' do
|
||||||
person_count = Person.all.count
|
person_count = Person.all.count
|
||||||
retraction = Retraction.for(@user)
|
request = @user.send_friend_request_to( @user2.receive_url, @group.id)
|
||||||
request = retraction.to_diaspora_xml
|
request.reverse @user2
|
||||||
|
xml = request.to_diaspora_xml
|
||||||
|
|
||||||
|
retraction = Retraction.for(@user2)
|
||||||
|
retraction_xml = retraction.to_diaspora_xml
|
||||||
|
|
||||||
|
@user2.person.destroy
|
||||||
|
@user2.destroy
|
||||||
|
@user.receive xml
|
||||||
|
|
||||||
|
@group.reload
|
||||||
|
group_people_count = @group.people.size
|
||||||
|
#They are now friends
|
||||||
|
|
||||||
|
|
||||||
Person.count.should == person_count
|
Person.count.should == person_count
|
||||||
@user.receive request
|
@user.receive retraction_xml
|
||||||
Person.count.should == person_count-1
|
Person.count.should == person_count-1
|
||||||
|
|
||||||
|
@group.reload
|
||||||
|
@group.people.size.should == group_people_count -1
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should marshal a profile for a person' do
|
it 'should marshal a profile for a person' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue