0
0
Fork 0

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
This commit is contained in:
Eugen Rochko 2017-06-14 18:01:27 +02:00 committed by GitHub
parent a208e7d655
commit 4a618908e8
15 changed files with 183 additions and 7 deletions

View file

@ -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 ?

View file

@ -0,0 +1,7 @@
# frozen_string_literal: true
class Form::DeleteConfirmation
include ActiveModel::Model
attr_accessor :password
end