From 4a618908e836ecb94f70e99f2198ee7b3ba3b2ec Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 14 Jun 2017 18:01:27 +0200 Subject: Account deletion (#3728) * Add form for account deletion * If avatar or header are gone from source, remove them * Add option to have SuspendAccountService remove user record, add tests * Exclude suspended accounts from search --- app/models/account.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/models/account.rb') diff --git a/app/models/account.rb b/app/models/account.rb index 5c0f70ff8..72bad51a2 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -177,6 +177,7 @@ class Account < ApplicationRecord account_id IN (SELECT * FROM first_degree) AND target_account_id NOT IN (SELECT * FROM first_degree) AND target_account_id NOT IN (:excluded_account_ids) + AND accounts.suspended = false GROUP BY target_account_id, accounts.id ORDER BY count(account_id) DESC OFFSET :offset @@ -199,6 +200,7 @@ class Account < ApplicationRecord ts_rank_cd(#{textsearch}, #{query}, 32) AS rank FROM accounts WHERE #{query} @@ #{textsearch} + AND accounts.suspended = false ORDER BY rank DESC LIMIT ? SQL @@ -216,6 +218,7 @@ class Account < ApplicationRecord FROM accounts 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 GROUP BY accounts.id ORDER BY rank DESC LIMIT ? -- cgit