1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00
mastodon/app/controllers/admin/accounts_controller.rb

45 lines
1.2 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
class Admin::AccountsController < ApplicationController
before_action :require_admin!
2016-12-04 09:10:40 -08:00
before_action :set_account, except: :index
2016-12-13 04:42:10 -08:00
layout 'admin'
def index
@accounts = Account.alphabetic.paginate(page: params[:page], per_page: 40)
2016-12-04 09:10:40 -08:00
@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.silenced if params[:silenced].present?
@accounts = @accounts.recent if params[:recent].present?
@accounts = @accounts.suspended if params[:suspended].present?
2016-12-04 09:10:40 -08:00
end
def show; end
def update
if @account.update(account_params)
redirect_to admin_accounts_path
else
render :show
end
end
def suspend
Admin::SuspensionWorker.perform_async(@account.id)
redirect_to admin_accounts_path
end
2016-12-04 09:10:40 -08:00
private
def set_account
2016-12-03 10:08:07 -08:00
@account = Account.find(params[:id])
end
2016-12-04 09:10:40 -08:00
def account_params
2016-12-05 13:59:30 -08:00
params.require(:account).permit(:silenced, :suspended)
2016-12-04 09:10:40 -08:00
end
end