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 module Admin
class AccountsController < BaseController class AccountsController < BaseController
before_action :set_account, except: [:index, :batch] 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] before_action :require_local_account!, only: [:enable, :memorialize, :approve, :reject]
def index 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) redirect_to admin_accounts_path(status: 'pending'), notice: I18n.t('admin.accounts.rejected_msg', username: @account.acct)
end 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 def destroy
authorize @account, :destroy? authorize @account, :destroy?
Admin::AccountDeletionWorker.perform_async(@account.id) Admin::AccountDeletionWorker.perform_async(@account.id)

View file

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

View file

@ -1,4 +1,4 @@
- if account.suspended? - if account.suspended? && !account.remote_pending
%hr.spacer/ %hr.spacer/
- if account.suspension_origin_remote? - 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') %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? = 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) - 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') } = 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 - else
.action-buttons .action-buttons
%div %div

View file

@ -34,6 +34,7 @@ en:
add_email_domain_block: Block e-mail domain add_email_domain_block: Block e-mail domain
approve: Approve approve: Approve
approve_domain: Approve domain approve_domain: Approve domain
approve_remote: Approve remote account
approved_msg: Successfully approved %{username}'s sign-up application approved_msg: Successfully approved %{username}'s sign-up application
are_you_sure: Are you sure? are_you_sure: Are you sure?
avatar: Avatar avatar: Avatar
@ -118,7 +119,9 @@ en:
redownload: Refresh profile redownload: Refresh profile
redownloaded_msg: Successfully refreshed %{username}'s profile from origin redownloaded_msg: Successfully refreshed %{username}'s profile from origin
reject: Reject reject: Reject
reject_remote: Reject remote account
rejected_msg: Successfully rejected %{username}'s sign-up application rejected_msg: Successfully rejected %{username}'s sign-up application
remote_pending_hint_html: This account is currently on hold and temporarily suspended. The account must be approved before it can be made available on this server.
remote_suspension_irreversible: The data of this account has been irreversibly deleted. remote_suspension_irreversible: The data of this account has been irreversibly deleted.
remote_suspension_reversible_hint_html: The account has been suspended on their server, and the data will be fully removed on %{date}. Until then, the remote server can restore this account without any ill effects. If you wish to remove all of the account's data immediately, you can do so below. remote_suspension_reversible_hint_html: The account has been suspended on their server, and the data will be fully removed on %{date}. Until then, the remote server can restore this account without any ill effects. If you wish to remove all of the account's data immediately, you can do so below.
remove_avatar: Remove avatar remove_avatar: Remove avatar

View file

@ -32,6 +32,7 @@ ja:
add_email_domain_block: メールドメインブロックに追加 add_email_domain_block: メールドメインブロックに追加
approve: 承認 approve: 承認
approve_domain: ドメインを承認 approve_domain: ドメインを承認
approve_remote: リモートアカウントを承認
approved_msg: '%{username}さんの登録申請を承認しました' approved_msg: '%{username}さんの登録申請を承認しました'
are_you_sure: 本当に実行しますか? are_you_sure: 本当に実行しますか?
avatar: アイコン avatar: アイコン
@ -115,7 +116,9 @@ ja:
redownload: プロフィールを更新 redownload: プロフィールを更新
redownloaded_msg: '%{username}のプロフィールを正常に更新しました' redownloaded_msg: '%{username}のプロフィールを正常に更新しました'
reject: 却下 reject: 却下
reject_remote: リモートアカウントを却下
rejected_msg: '%{username}さんの登録申請を却下しました' rejected_msg: '%{username}さんの登録申請を却下しました'
remote_pending_hint_html: このアカウントは現在保留中で、一時的にサスペンド状態になっています。このサーバーで利用可能にするためには、アカウントを承認する必要があります。
remote_suspension_irreversible: このアカウントのデータは不可逆的に削除されました。 remote_suspension_irreversible: このアカウントのデータは不可逆的に削除されました。
remote_suspension_reversible_hint_html: このアカウントは停止されており、データは%{date} 日で完全に削除されます。それまでは悪影響なしにアカウントを復旧させることができます。アカウントを即座に削除したい場合は、以下から行うことができます。 remote_suspension_reversible_hint_html: このアカウントは停止されており、データは%{date} 日で完全に削除されます。それまでは悪影響なしにアカウントを復旧させることができます。アカウントを即座に削除したい場合は、以下から行うことができます。
remove_avatar: アイコンを削除 remove_avatar: アイコンを削除

View file

@ -130,6 +130,8 @@ namespace :admin do
post :memorialize post :memorialize
post :approve post :approve
post :reject post :reject
post :approve_remote
post :reject_remote
post :unblock_email post :unblock_email
end end