about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-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