Change algorithm of follow recommendations (#28314)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
b7bdcd4f39
commit
b5ac61b2c5
35 changed files with 297 additions and 292 deletions
|
@ -13,13 +13,12 @@ RSpec.describe 'Suggestions' do
|
|||
get '/api/v1/suggestions', headers: headers, params: params
|
||||
end
|
||||
|
||||
let(:bob) { Fabricate(:account) }
|
||||
let(:jeff) { Fabricate(:account) }
|
||||
let(:bob) { Fabricate(:account) }
|
||||
let(:jeff) { Fabricate(:account) }
|
||||
let(:params) { {} }
|
||||
|
||||
before do
|
||||
PotentialFriendshipTracker.record(user.account_id, bob.id, :reblog)
|
||||
PotentialFriendshipTracker.record(user.account_id, jeff.id, :favourite)
|
||||
Setting.bootstrap_timeline_accounts = [bob, jeff].map(&:acct).join(',')
|
||||
end
|
||||
|
||||
it_behaves_like 'forbidden for wrong scope', 'write'
|
||||
|
@ -65,17 +64,15 @@ RSpec.describe 'Suggestions' do
|
|||
delete "/api/v1/suggestions/#{jeff.id}", headers: headers
|
||||
end
|
||||
|
||||
let(:suggestions_source) { instance_double(AccountSuggestions::PastInteractionsSource, remove: nil) }
|
||||
let(:bob) { Fabricate(:account) }
|
||||
let(:jeff) { Fabricate(:account) }
|
||||
let(:bob) { Fabricate(:account) }
|
||||
let(:jeff) { Fabricate(:account) }
|
||||
let(:scopes) { 'write' }
|
||||
|
||||
before do
|
||||
PotentialFriendshipTracker.record(user.account_id, bob.id, :reblog)
|
||||
PotentialFriendshipTracker.record(user.account_id, jeff.id, :favourite)
|
||||
allow(AccountSuggestions::PastInteractionsSource).to receive(:new).and_return(suggestions_source)
|
||||
Setting.bootstrap_timeline_accounts = [bob, jeff].map(&:acct).join(',')
|
||||
end
|
||||
|
||||
it_behaves_like 'forbidden for wrong scope', 'write'
|
||||
it_behaves_like 'forbidden for wrong scope', 'read'
|
||||
|
||||
it 'returns http success' do
|
||||
subject
|
||||
|
@ -86,8 +83,7 @@ RSpec.describe 'Suggestions' do
|
|||
it 'removes the specified suggestion' do
|
||||
subject
|
||||
|
||||
expect(suggestions_source).to have_received(:remove).with(user.account, jeff.id.to_s).once
|
||||
expect(suggestions_source).to_not have_received(:remove).with(user.account, bob.id.to_s)
|
||||
expect(FollowRecommendationMute.exists?(account: user.account, target_account: jeff)).to be true
|
||||
end
|
||||
|
||||
context 'without an authorization header' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue