about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-12-12 02:14:33 +0100
committerGitHub <noreply@github.com>2017-12-12 02:14:33 +0100
commit481fac7c8401a47af52043cd4db05b6dd984d8a9 (patch)
tree1b969c10c3385177c6d2ed902c9c718c640ee6c0 /app
parentc588fcf4bce63fa74a4232952a1d5dfe76a9b160 (diff)
Exclude moved accounts from search results (#5984)
Diffstat (limited to 'app')
-rw-r--r--app/models/account.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index e8a8c6560..686e74044 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -285,6 +285,7 @@ class Account < ApplicationRecord
         FROM accounts
         WHERE #{query} @@ #{textsearch}
           AND accounts.suspended = false
+          AND accounts.moved_to_account_id IS NULL
         ORDER BY rank DESC
         LIMIT ?
       SQL
@@ -310,6 +311,7 @@ class Account < ApplicationRecord
           WHERE accounts.id IN (SELECT * FROM first_degree)
             AND #{query} @@ #{textsearch}
             AND accounts.suspended = false
+            AND accounts.moved_to_account_id IS NULL
           GROUP BY accounts.id
           ORDER BY rank DESC
           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 = ?)
           WHERE #{query} @@ #{textsearch}
             AND accounts.suspended = false
+            AND accounts.moved_to_account_id IS NULL
           GROUP BY accounts.id
           ORDER BY rank DESC
           LIMIT ?