]> cat aescling's git repositories - mastodon.git/commitdiff
Exclude moved accounts from search results (#5984)
authorEugen Rochko <eugen@zeonfederated.com>
Tue, 12 Dec 2017 01:14:33 +0000 (02:14 +0100)
committerGitHub <noreply@github.com>
Tue, 12 Dec 2017 01:14:33 +0000 (02:14 +0100)
app/models/account.rb

index e8a8c65608647c87a24e7d4b352500a89c6dd20e..686e740440761fc58ad6f70d1814b95c87d75ac7 100644 (file)
@@ -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 ?