forked from cybrespace/mastodon
Exclude moved accounts from search results (#5984)
This commit is contained in:
parent
c588fcf4bc
commit
481fac7c84
|
@ -285,6 +285,7 @@ class Account < ApplicationRecord
|
||||||
FROM accounts
|
FROM accounts
|
||||||
WHERE #{query} @@ #{textsearch}
|
WHERE #{query} @@ #{textsearch}
|
||||||
AND accounts.suspended = false
|
AND accounts.suspended = false
|
||||||
|
AND accounts.moved_to_account_id IS NULL
|
||||||
ORDER BY rank DESC
|
ORDER BY rank DESC
|
||||||
LIMIT ?
|
LIMIT ?
|
||||||
SQL
|
SQL
|
||||||
|
@ -310,6 +311,7 @@ class Account < ApplicationRecord
|
||||||
WHERE accounts.id IN (SELECT * FROM first_degree)
|
WHERE accounts.id IN (SELECT * FROM first_degree)
|
||||||
AND #{query} @@ #{textsearch}
|
AND #{query} @@ #{textsearch}
|
||||||
AND accounts.suspended = false
|
AND accounts.suspended = false
|
||||||
|
AND accounts.moved_to_account_id IS NULL
|
||||||
GROUP BY accounts.id
|
GROUP BY accounts.id
|
||||||
ORDER BY rank DESC
|
ORDER BY rank DESC
|
||||||
LIMIT ?
|
LIMIT ?
|
||||||
|
@ -325,6 +327,7 @@ class Account < ApplicationRecord
|
||||||
LEFT OUTER JOIN follows AS f ON (accounts.id = f.account_id AND f.target_account_id = ?) OR (accounts.id = f.target_account_id AND f.account_id = ?)
|
LEFT OUTER JOIN follows AS f ON (accounts.id = f.account_id AND f.target_account_id = ?) OR (accounts.id = f.target_account_id AND f.account_id = ?)
|
||||||
WHERE #{query} @@ #{textsearch}
|
WHERE #{query} @@ #{textsearch}
|
||||||
AND accounts.suspended = false
|
AND accounts.suspended = false
|
||||||
|
AND accounts.moved_to_account_id IS NULL
|
||||||
GROUP BY accounts.id
|
GROUP BY accounts.id
|
||||||
ORDER BY rank DESC
|
ORDER BY rank DESC
|
||||||
LIMIT ?
|
LIMIT ?
|
||||||
|
|
Loading…
Reference in New Issue