fix #4163 - Now updating correct contact attribute on retraction
Added test case for Issue #4163
This commit is contained in:
parent
7729b1e8e0
commit
6900146852
3 changed files with 13 additions and 4 deletions
|
|
@ -19,6 +19,7 @@
|
||||||
* Fix Facebox icons 404s when called from Backbone
|
* Fix Facebox icons 404s when called from Backbone
|
||||||
* Fix deleting a post from Facebook [#4290](https://github.com/diaspora/diaspora/pull/4290)
|
* Fix deleting a post from Facebook [#4290](https://github.com/diaspora/diaspora/pull/4290)
|
||||||
* Display notices a little bit longer to help on sign up errors [#4274](https://github.com/diaspora/diaspora/issues/4274)
|
* Display notices a little bit longer to help on sign up errors [#4274](https://github.com/diaspora/diaspora/issues/4274)
|
||||||
|
* Fix user contact sharing/receiving [#4163](https://github.com/diaspora/diaspora/issues/4163)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
* Admin: add option to find users under 13 (COPPA) [#4252](https://github.com/diaspora/diaspora/pull/4252)
|
* Admin: add option to find users under 13 (COPPA) [#4252](https://github.com/diaspora/diaspora/pull/4252)
|
||||||
|
|
@ -32,7 +33,7 @@
|
||||||
|
|
||||||
## Refactor
|
## Refactor
|
||||||
|
|
||||||
* Refactored config/ directory [#4145](https://github.com/diaspora/diaspora/pull/4145).
|
* Refactored config/ directory [#4144](https://github.com/diaspora/diaspora/pull/4145).
|
||||||
* Drop misleading fallback donation form. [Proposal](https://www.loomio.org/discussions/1045?proposal=2722)
|
* Drop misleading fallback donation form. [Proposal](https://www.loomio.org/discussions/1045?proposal=2722)
|
||||||
* Update Typhoeus to 0.6.3 and refactor HydraWrapper. [#4162](https://github.com/diaspora/diaspora/pull/4162)
|
* Update Typhoeus to 0.6.3 and refactor HydraWrapper. [#4162](https://github.com/diaspora/diaspora/pull/4162)
|
||||||
* Bump recomended Ruby version to 1.9.3-p448, see [Ruby news](http://www.ruby-lang.org/en/news/2013/06/27/hostname-check-bypassing-vulnerability-in-openssl-client-cve-2013-4073/).
|
* Bump recomended Ruby version to 1.9.3-p448, see [Ruby news](http://www.ruby-lang.org/en/news/2013/06/27/hostname-check-bypassing-vulnerability-in-openssl-client-cve-2013-4073/).
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,13 @@ module User::Connecting
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_contact(contact, opts={:force => false})
|
def remove_contact(contact, opts={:force => false, :retracted => false})
|
||||||
posts = contact.posts.all
|
posts = contact.posts.all
|
||||||
|
|
||||||
if !contact.mutual? || opts[:force]
|
if !contact.mutual? || opts[:force]
|
||||||
contact.destroy
|
contact.destroy
|
||||||
|
elsif opts[:retracted]
|
||||||
|
contact.update_attributes(:sharing => false)
|
||||||
else
|
else
|
||||||
contact.update_attributes(:receiving => false)
|
contact.update_attributes(:receiving => false)
|
||||||
end
|
end
|
||||||
|
|
@ -65,7 +67,7 @@ module User::Connecting
|
||||||
def disconnected_by(person)
|
def disconnected_by(person)
|
||||||
Rails.logger.info("event=disconnected_by user=#{diaspora_handle} target=#{person.diaspora_handle}")
|
Rails.logger.info("event=disconnected_by user=#{diaspora_handle} target=#{person.diaspora_handle}")
|
||||||
if contact = self.contact_for(person)
|
if contact = self.contact_for(person)
|
||||||
remove_contact(contact)
|
remove_contact(contact, :retracted => true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,16 @@ describe User::Connecting do
|
||||||
|
|
||||||
describe '#disconnected_by' do
|
describe '#disconnected_by' do
|
||||||
it 'calls remove contact' do
|
it 'calls remove contact' do
|
||||||
bob.should_receive(:remove_contact).with(bob.contact_for(alice.person))
|
bob.should_receive(:remove_contact).with(bob.contact_for(alice.person), :retracted => true)
|
||||||
bob.disconnected_by(alice.person)
|
bob.disconnected_by(alice.person)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'removes contact sharing flag' do
|
||||||
|
bob.contacts.find_by_person_id(alice.person.id).should be_sharing
|
||||||
|
bob.disconnected_by(alice.person)
|
||||||
|
bob.contacts.find_by_person_id(alice.person.id).should_not be_sharing
|
||||||
|
end
|
||||||
|
|
||||||
it 'removes notitications' do
|
it 'removes notitications' do
|
||||||
alice.share_with(eve.person, alice.aspects.first)
|
alice.share_with(eve.person, alice.aspects.first)
|
||||||
Notifications::StartedSharing.where(:recipient_id => eve.id).first.should_not be_nil
|
Notifications::StartedSharing.where(:recipient_id => eve.id).first.should_not be_nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue