Disable actions on reports that have already been taken (#31773)

This commit is contained in:
Emelia Smith 2024-09-06 14:50:30 +02:00 committed by GitHub
parent 1fed11cfa7
commit fd7fc7bdc3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 28 additions and 3 deletions

View file

@ -1,6 +1,13 @@
- content_for :page_title do
= t('admin.account_actions.title', acct: @account.pretty_acct)
- if @account.suspended?
.flash-message.alert
= t('admin.account_actions.already_suspended')
- elsif @account.silenced?
.flash-message.warn
= t('admin.account_actions.already_silenced')
= simple_form_for @account_action, url: admin_account_action_path(@account.id) do |f|
= f.input :report_id,
as: :hidden
@ -9,6 +16,7 @@
= f.input :type,
as: :radio_buttons,
collection: Admin::AccountAction.types_for_account(@account),
disabled: Admin::AccountAction.disabled_types_for_account(@account),
hint: t('simple_form.hints.admin_account_action.type_html', acct: @account.pretty_acct),
include_blank: false,
label_method: ->(type) { account_action_type_label(type) },

View file

@ -17,21 +17,27 @@
.report-actions__item__button
= form.button t('admin.reports.delete_and_resolve'),
name: :delete,
class: 'button button--destructive'
class: 'button button--destructive',
disabled: statuses.empty?,
title: statuses.empty? ? t('admin.reports.actions_no_posts') : ''
.report-actions__item__description
= t('admin.reports.actions.delete_description_html')
.report-actions__item
.report-actions__item__button
= form.button t('admin.accounts.silence'),
name: :silence,
class: 'button button--destructive'
class: 'button button--destructive',
disabled: report.target_account.silenced? || report.target_account.suspended?,
title: report.target_account.silenced? ? t('admin.account_actions.already_silenced') : ''
.report-actions__item__description
= t('admin.reports.actions.silence_description_html')
.report-actions__item
.report-actions__item__button
= form.button t('admin.accounts.suspend'),
name: :suspend,
class: 'button button--destructive'
class: 'button button--destructive',
disabled: report.target_account.suspended?,
title: report.target_account.suspended? ? t('admin.account_actions.already_suspended') : ''
.report-actions__item__description
= t('admin.reports.actions.suspend_description_html')
.report-actions__item