Do not autofollow back a user you are ignoring
fixes #7808 closes #7913
This commit is contained in:
parent
58d2ce7ba6
commit
6804132c15
5 changed files with 63 additions and 11 deletions
|
|
@ -4,6 +4,7 @@
|
|||
* Improve public stream performance and cleanup unused indexes [#7944](https://github.com/diaspora/diaspora/pull/7944)
|
||||
|
||||
## Bug fixes
|
||||
* Do not autofollow back a user you are ignoring [#7913](https://github.com/diaspora/diaspora/pull/7913)
|
||||
|
||||
## Features
|
||||
* Suppoert ignore users on mobile [#7884](https://github.com/diaspora/diaspora/pull/7884)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ class User
|
|||
# @param [Aspect] aspect The aspect to add them to.
|
||||
# @return [Contact] The newly made contact for the passed in person.
|
||||
def share_with(person, aspect)
|
||||
return if blocks.where(person_id: person.id).exists?
|
||||
|
||||
contact = contacts.find_or_initialize_by(person_id: person.id)
|
||||
return false unless contact.valid?
|
||||
|
||||
|
|
|
|||
36
features/desktop/auto_follow_back.feature
Normal file
36
features/desktop/auto_follow_back.feature
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
@javascript
|
||||
Feature: auto follow back a user
|
||||
|
||||
Background:
|
||||
Given following users exist:
|
||||
| username | email |
|
||||
| Bob Jones | bob@bob.bob |
|
||||
| Alice Smith | alice@alice.alice |
|
||||
And I sign in as "bob@bob.bob"
|
||||
And I have an aspect called "My main aspect"
|
||||
And I have an aspect called "Others" with auto follow back
|
||||
And I sign out
|
||||
|
||||
Scenario: When a user with auto follow back enabled is shared with, he's sharing back
|
||||
When I sign in as "alice@alice.alice"
|
||||
And I am on "bob@bob.bob"'s page
|
||||
And I add the person to my "Besties" aspect
|
||||
And I sign out
|
||||
And I sign in as "bob@bob.bob"
|
||||
Then I should have 1 contact in "Others"
|
||||
When I am on "alice@alice.alice"'s page
|
||||
Then I should see "Others" within the contact aspect dropdown
|
||||
|
||||
Scenario: When a user with auto follow back enabled is shared with by a user he's ignoring, he's not sharing back
|
||||
When I sign in as "bob@bob.bob"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
And I click on the profile block button
|
||||
And I sign out
|
||||
When I sign in as "alice@alice.alice"
|
||||
And I am on "bob@bob.bob"'s page
|
||||
And I add the person to my "Besties" aspect
|
||||
And I sign out
|
||||
And I sign in as "bob@bob.bob"
|
||||
Then I should have 0 contact in "Others"
|
||||
When I am on "alice@alice.alice"'s page
|
||||
Then I should see "Stop ignoring" within "#unblock_user_button"
|
||||
|
|
@ -38,6 +38,26 @@ module AspectCukeHelpers
|
|||
end
|
||||
World(AspectCukeHelpers)
|
||||
|
||||
Given /^I have an aspect called "([^\"]*)"$/ do |aspect_name|
|
||||
@me.aspects.create!(name: aspect_name)
|
||||
@me.reload
|
||||
end
|
||||
|
||||
Given /^I have an aspect called "([^\"]*)" with auto follow back$/ do |aspect_name|
|
||||
aspect = @me.aspects.create!(name: aspect_name)
|
||||
@me.auto_follow_back = true
|
||||
@me.auto_follow_back_aspect = aspect
|
||||
@me.save
|
||||
@me.reload
|
||||
end
|
||||
|
||||
Given /^I have following aspect[s]?:$/ do |fields|
|
||||
fields.raw.each do |field|
|
||||
@me.aspects.create!(name: field[0])
|
||||
end
|
||||
@me.reload
|
||||
end
|
||||
|
||||
When /^I click on "([^"]*)" aspect edit icon$/ do |aspect_name|
|
||||
within(".all-aspects") do
|
||||
li = find('li', text: aspect_name)
|
||||
|
|
@ -112,6 +132,10 @@ And /^I toggle the aspect "([^"]*)"$/ do |name|
|
|||
toggle_aspect(name)
|
||||
end
|
||||
|
||||
Then /^I should see "([^"]*)" within the contact aspect dropdown$/ do |aspect_name|
|
||||
expect(find(".dropdown-toggle .text")).to have_content aspect_name
|
||||
end
|
||||
|
||||
Then /^I should see "([^"]*)" aspect selected$/ do |aspect_name|
|
||||
aspect = @me.aspects.where(:name => aspect_name).first
|
||||
within("#aspects_list") do
|
||||
|
|
|
|||
|
|
@ -72,17 +72,6 @@ When /^I click on my name$/ do
|
|||
click_link("#{@me.first_name} #{@me.last_name}")
|
||||
end
|
||||
|
||||
Given /^I have an aspect called "([^\"]*)"$/ do |aspect_name|
|
||||
@me.aspects.create!(:name => aspect_name)
|
||||
@me.reload
|
||||
end
|
||||
|
||||
Given /^I have following aspect[s]?:$/ do |fields|
|
||||
fields.raw.each do |field|
|
||||
step %{I have an aspect called "#{field[0]}"}
|
||||
end
|
||||
end
|
||||
|
||||
When /^I have user with username "([^"]*)" in an aspect called "([^"]*)"$/ do |username, aspect|
|
||||
user = User.find_by_username(username)
|
||||
contact = @me.reload.contact_for(user.person)
|
||||
|
|
|
|||
Loading…
Reference in a new issue