Skip to content
Snippets Groups Projects
Unverified Commit 481fac7c authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Exclude moved accounts from search results (#5984)

parent c588fcf4
No related branches found
No related tags found
No related merge requests found
...@@ -285,6 +285,7 @@ class Account < ApplicationRecord ...@@ -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 ...@@ -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 ...@@ -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 ?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment