Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
mastodon
Commits
34a62ff4
Commit
34a62ff4
authored
4 years ago
by
Eugen Rochko
Browse files
Options
Download
Email Patches
Plain Diff
Fix account search showing results from domains hidden by user
Fix #8586
parent
52157fdc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/services/account_search_service.rb
+14
-4
app/services/account_search_service.rb
with
14 additions
and
4 deletions
+14
-4
app/services/account_search_service.rb
+
14
-
4
View file @
34a62ff4
...
...
@@ -46,9 +46,19 @@ class AccountSearchService < BaseService
return
[]
if
limit_for_non_exact_results
.
zero?
@search_results
||=
begin
results
=
from_elasticsearch
if
Chewy
.
enabled?
results
=
from_elasticsearch
if
Chewy
.
enabled?
results
||=
from_database
results
results
.
reject
{
|
result
|
excluded_domains
.
include?
(
result
.
domain
)
}
end
end
def
excluded_domains
@excluded_domains
||=
begin
if
account
Set
.
new
(
account
.
excluded_from_timeline_domains
)
else
Set
.
new
end
end
end
...
...
@@ -69,8 +79,8 @@ class AccountSearchService < BaseService
end
def
from_elasticsearch
must_clauses
=
[{
multi_match:
{
query:
terms_for_query
,
fields:
likely_acct?
?
%w(acct.edge_ngram acct)
:
%w(acct.edge_ngram acct display_name.edge_ngram display_name)
,
type:
'most_fields'
,
operator:
'and'
}
}]
should_clauses
=
[]
must_clauses
=
[{
multi_match:
{
query:
terms_for_query
,
fields:
likely_acct?
?
%w(acct.edge_ngram acct)
:
%w(acct.edge_ngram acct display_name.edge_ngram display_name)
,
type:
'most_fields'
,
operator:
'and'
}
}]
should_clauses
=
[]
if
account
return
[]
if
options
[
:following
]
&&
following_ids
.
empty?
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets