Fix: #588 リモート保留中ユーザーに関して、サスペンドから戻す操作を削除 (#589)

* Fix: #588 リモート保留中ユーザーに関して、サスペンドから戻す操作を削除

* 条件を書く場所を変更

* 各アカウントの画面を調整
This commit is contained in:
KMY(雪あすか) 2024-02-18 08:37:22 +09:00 committed by GitHub
parent 0a6e68255f
commit 1b3c0e3fb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 30 additions and 4 deletions

View file

@ -3,7 +3,7 @@
module Admin
class AccountsController < BaseController
before_action :set_account, except: [:index, :batch]
before_action :require_remote_account!, only: [:redownload]
before_action :require_remote_account!, only: [:redownload, :approve_remote, :reject_remote]
before_action :require_local_account!, only: [:enable, :memorialize, :approve, :reject]
def index
@ -66,6 +66,20 @@ module Admin
redirect_to admin_accounts_path(status: 'pending'), notice: I18n.t('admin.accounts.rejected_msg', username: @account.acct)
end
def approve_remote
authorize @account, :approve_remote?
@account.approve_remote!
log_action :approve_remote, @account
redirect_to admin_account_path(@account.id), notice: I18n.t('admin.accounts.approved_msg', username: @account.acct)
end
def reject_remote
authorize @account, :reject_remote?
@account.reject_remote!
log_action :reject_remote, @account
redirect_to admin_account_path(@account.id), notice: I18n.t('admin.accounts.rejected_msg', username: @account.acct)
end
def destroy
authorize @account, :destroy?
Admin::AccountDeletionWorker.perform_async(@account.id)

View file

@ -303,8 +303,7 @@ class Account < ApplicationRecord
end
def reject_remote!
update!(remote_pending: false)
suspend!
update!(remote_pending: false, suspension_origin: :local)
end
def sensitized?

View file

@ -1,4 +1,4 @@
- if account.suspended?
- if account.suspended? && !account.remote_pending
%hr.spacer/
- if account.suspension_origin_remote?
%p.muted-hint= deletion_request.present? ? t('admin.accounts.remote_suspension_reversible_hint_html', date: content_tag(:strong, l(deletion_request.due_at.to_date))) : t('admin.accounts.remote_suspension_irreversible')
@ -8,6 +8,11 @@
= link_to t('admin.accounts.redownload'), redownload_admin_account_path(account.id), method: :post, class: 'button' if can?(:redownload, account) && account.suspension_origin_remote?
- if deletion_request.present? && can?(:destroy, account)
= link_to t('admin.accounts.delete'), admin_account_path(account.id), method: :delete, class: 'button button--destructive', data: { confirm: t('admin.accounts.are_you_sure') }
- elsif account.suspended? && account.remote_pending
%hr.spacer/
%p.muted-hint= t('admin.accounts.remote_pending_hint_html')
= link_to t('admin.accounts.approve_remote'), approve_remote_admin_account_path(account.id), method: :post, class: 'button' if can?(:approve_remote, account)
= link_to t('admin.accounts.reject_remote'), reject_remote_admin_account_path(account.id), method: :post, class: 'button' if can?(:reject_remote, account)
- else
.action-buttons
%div