0
0
Fork 0

Change algorithm of follow recommendations (#28314)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Eugen Rochko 2023-12-19 11:59:43 +01:00 committed by GitHub
parent b7bdcd4f39
commit b5ac61b2c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 297 additions and 292 deletions

View file

@ -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