2016-11-30 14:32:26 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-10 19:27:03 +00:00
|
|
|
module Admin
|
|
|
|
class AccountsController < BaseController
|
|
|
|
before_action :set_account, except: :index
|
|
|
|
|
|
|
|
def index
|
2017-04-10 23:11:41 +00:00
|
|
|
@accounts = Account.alphabetic.page(params[:page])
|
2017-04-10 19:27:03 +00: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?
|
|
|
|
end
|
|
|
|
|
|
|
|
def show; end
|
|
|
|
|
|
|
|
def suspend
|
|
|
|
Admin::SuspensionWorker.perform_async(@account.id)
|
|
|
|
redirect_to admin_accounts_path
|
|
|
|
end
|
|
|
|
|
|
|
|
def unsuspend
|
|
|
|
@account.update(suspended: false)
|
|
|
|
redirect_to admin_accounts_path
|
|
|
|
end
|
|
|
|
|
|
|
|
def silence
|
|
|
|
@account.update(silenced: true)
|
|
|
|
redirect_to admin_accounts_path
|
|
|
|
end
|
|
|
|
|
|
|
|
def unsilence
|
|
|
|
@account.update(silenced: false)
|
|
|
|
redirect_to admin_accounts_path
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def set_account
|
|
|
|
@account = Account.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def account_params
|
|
|
|
params.require(:account).permit(:silenced, :suspended)
|
|
|
|
end
|
2016-12-04 17:10:40 +00:00
|
|
|
end
|
2016-11-30 14:32:26 +00:00
|
|
|
end
|