Revertしたコミットを復元
This commit is contained in:
parent
76598bd542
commit
b3c2e47ea8
3 changed files with 16 additions and 24 deletions
|
@ -1,10 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Reverted this commit.temporarily because load issues.
|
||||
# Whenever a manual merge occurs, be sure to check the following commits.
|
||||
# Hash: ee8d0b94473df357677cd1f82581251ce0423c01
|
||||
# Message: Fix follow suggestions potentially including silenced or blocked accounts (#29306)
|
||||
|
||||
class AccountSuggestions::SimilarProfilesSource < AccountSuggestions::Source
|
||||
class QueryBuilder < AccountSearchService::QueryBuilder
|
||||
def must_clauses
|
||||
|
@ -56,7 +51,8 @@ class AccountSuggestions::SimilarProfilesSource < AccountSuggestions::Source
|
|||
recently_followed_account_ids = account.active_relationships.recent.limit(5).pluck(:target_account_id)
|
||||
|
||||
if Chewy.enabled? && !recently_followed_account_ids.empty?
|
||||
QueryBuilder.new(recently_followed_account_ids, account).build.limit(limit).hits.pluck('_id').map(&:to_i).zip([key].cycle)
|
||||
ids_from_es = QueryBuilder.new(recently_followed_account_ids, account).build.limit(limit).hits.pluck('_id').map(&:to_i)
|
||||
base_account_scope(account).where(id: ids_from_es).pluck(:id).zip([key].cycle)
|
||||
else
|
||||
[]
|
||||
end
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Reverted this commit.temporarily because load issues.
|
||||
# Whenever a manual merge occurs, be sure to check the following commits.
|
||||
# Hash: ee8d0b94473df357677cd1f82581251ce0423c01
|
||||
# Message: Fix follow suggestions potentially including silenced or blocked accounts (#29306)
|
||||
|
||||
class AccountSuggestions::Source
|
||||
DEFAULT_LIMIT = 10
|
||||
|
||||
|
@ -17,6 +12,8 @@ class AccountSuggestions::Source
|
|||
def base_account_scope(account)
|
||||
Account
|
||||
.searchable
|
||||
.where(discoverable: true)
|
||||
.without_silenced
|
||||
.where.not(follows_sql, id: account.id)
|
||||
.where.not(follow_requests_sql, id: account.id)
|
||||
.not_excluded_by_account(account)
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Reverted this commit.temporarily because load issues.
|
||||
# Whenever a manual merge occurs, be sure to check the following commits.
|
||||
# Hash: ee8d0b94473df357677cd1f82581251ce0423c01
|
||||
# Message: Fix follow suggestions potentially including silenced or blocked accounts (#29306)
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AccountSuggestions::Source do
|
||||
|
@ -16,14 +11,16 @@ RSpec.describe AccountSuggestions::Source do
|
|||
end
|
||||
|
||||
context 'with follows and follow requests' do
|
||||
let!(:account_domain_blocked_account) { Fabricate(:account, domain: 'blocked.host') }
|
||||
let!(:account) { Fabricate(:account) }
|
||||
let!(:blocked_account) { Fabricate(:account) }
|
||||
let!(:eligible_account) { Fabricate(:account) }
|
||||
let!(:follow_recommendation_muted_account) { Fabricate(:account) }
|
||||
let!(:follow_requested_account) { Fabricate(:account) }
|
||||
let!(:following_account) { Fabricate(:account) }
|
||||
let!(:moved_account) { Fabricate(:account, moved_to_account: Fabricate(:account)) }
|
||||
let!(:account_domain_blocked_account) { Fabricate(:account, domain: 'blocked.host', discoverable: true) }
|
||||
let!(:account) { Fabricate(:account, discoverable: true) }
|
||||
let!(:blocked_account) { Fabricate(:account, discoverable: true) }
|
||||
let!(:eligible_account) { Fabricate(:account, discoverable: true) }
|
||||
let!(:follow_recommendation_muted_account) { Fabricate(:account, discoverable: true) }
|
||||
let!(:follow_requested_account) { Fabricate(:account, discoverable: true) }
|
||||
let!(:following_account) { Fabricate(:account, discoverable: true) }
|
||||
let!(:moved_account) { Fabricate(:account, moved_to_account: Fabricate(:account), discoverable: true) }
|
||||
let!(:silenced_account) { Fabricate(:account, silenced: true, discoverable: true) }
|
||||
let!(:undiscoverable_account) { Fabricate(:account, discoverable: false) }
|
||||
|
||||
before do
|
||||
Fabricate :account_domain_block, account: account, domain: account_domain_blocked_account.domain
|
||||
|
@ -45,6 +42,8 @@ RSpec.describe AccountSuggestions::Source do
|
|||
.and not_include(follow_requested_account)
|
||||
.and not_include(following_account)
|
||||
.and not_include(moved_account)
|
||||
.and not_include(silenced_account)
|
||||
.and not_include(undiscoverable_account)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue