about summary refs log tree commit diff
path: root/app/controllers/admin
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-12-06 18:22:59 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-12-06 18:22:59 +0100
commitf978b06dd188fef4c2ece5e787818579b663ddf8 (patch)
tree70a0969b208ac3b0393c5fb9e54b8bd222782e6f /app/controllers/admin
parentf406e01fcf7d69045cf3ad8ea8dea51acd85535b (diff)
Add suspend account functionality to admin UI
Diffstat (limited to 'app/controllers/admin')
-rw-r--r--app/controllers/admin/accounts_controller.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb
index ff1989b52..55436d253 100644
--- a/app/controllers/admin/accounts_controller.rb
+++ b/app/controllers/admin/accounts_controller.rb
@@ -7,13 +7,14 @@ class Admin::AccountsController < ApplicationController
   layout 'public'
 
   def index
-    @accounts = Account.order('domain ASC, username ASC').paginate(page: params[:page], per_page: 40)
+    @accounts = Account.alphabetic.paginate(page: params[:page], per_page: 40)
 
     @accounts = @accounts.local                             if params[:local].present?
     @accounts = @accounts.remote                            if params[:remote].present?
     @accounts = @accounts.where(domain: params[:by_domain]) if params[:by_domain].present?
-    @accounts = @accounts.where(silenced: true)             if params[:silenced].present?
-    @accounts = @accounts.reorder('id desc')                if params[:recent].present?
+    @accounts = @accounts.silenced                          if params[:silenced].present?
+    @accounts = @accounts.recent                            if params[:recent].present?
+    @accounts = @accounts.suspended                         if params[:suspended].present?
   end
 
   def show; end
@@ -26,6 +27,11 @@ class Admin::AccountsController < ApplicationController
     end
   end
 
+  def suspend
+    Admin::SuspensionWorker.perform_async(@account.id)
+    redirect_to admin_accounts_path
+  end
+
   private
 
   def set_account