about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-06-14 18:01:27 +0200
committerGitHub <noreply@github.com>2017-06-14 18:01:27 +0200
commit4a618908e836ecb94f70e99f2198ee7b3ba3b2ec (patch)
treef2a02c2deaf9c1af2b53dae705cc652f83e08db7 /app/models
parenta208e7d65581168cda04be543742f302a162ac1a (diff)
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
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account.rb3
-rw-r--r--app/models/form/delete_confirmation.rb7
2 files changed, 10 insertions, 0 deletions
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 ?
diff --git a/app/models/form/delete_confirmation.rb b/app/models/form/delete_confirmation.rb
new file mode 100644
index 000000000..0884a09b8
--- /dev/null
+++ b/app/models/form/delete_confirmation.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class Form::DeleteConfirmation
+  include ActiveModel::Model
+
+  attr_accessor :password
+end