do not auto follow back if already sharing

This commit is contained in:
Jonne Haß 2012-01-31 14:34:09 +01:00
parent 5914ed4ef1
commit 7a8bd7595b
2 changed files with 18 additions and 3 deletions

View file

@ -80,7 +80,7 @@ class Request
contact.sharing = true
contact.save
user.share_with(person, user.auto_follow_back_aspect) if user.auto_follow_back
user.share_with(person, user.auto_follow_back_aspect) if user.auto_follow_back && !contact.receiving
self
end

View file

@ -96,7 +96,7 @@ describe Request do
it 'shares back if auto_following is enabled' do
alice.auto_follow_back = true
alice.auto_follow_back_aspect = alice.aspects.first
eve.save
alice.save
Request.diaspora_initialize(:from => eve.person, :to => alice.person,
:into => eve.aspects.first).receive(alice, eve.person)
@ -107,13 +107,28 @@ describe Request do
it 'shares not back if auto_following is not enabled' do
alice.auto_follow_back = false
alice.auto_follow_back_aspect = alice.aspects.first
eve.save
alice.save
Request.diaspora_initialize(:from => eve.person, :to => alice.person,
:into => eve.aspects.first).receive(alice, eve.person)
eve.contact_for(alice.person).should be_nil
end
it 'shares not back if already sharing' do
alice.auto_follow_back = true
alice.auto_follow_back_aspect = alice.aspects.first
alice.save
contact = Factory :contact, :user => alice, :person => eve.person,
:receiving => true, :sharing => false
contact.save
alice.should_not_receive(:share_with)
Request.diaspora_initialize(:from => eve.person, :to => alice.person,
:into => eve.aspects.first).receive(alice, eve.person)
end
end
context 'xml' do