mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-15 19:33:32 +00:00
4ada50985a
* Replace will_paginate with kaminari * Use #page instead of #paginate in controllers * Replace will_paginate.page_gap with pagination.truncate in i18n * Customize kaminari views to match prior styles * Set kaminari options to match prior behavior * Replace will_paginate with paginate in views
51 lines
1.4 KiB
Ruby
51 lines
1.4 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module Admin
|
|
class AccountsController < BaseController
|
|
before_action :set_account, except: :index
|
|
|
|
def index
|
|
@accounts = Account.alphabetic.page(params[:page])
|
|
|
|
@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
|
|
end
|
|
end
|