diff --git a/app/controllers/admin/media_attachments_controller.rb b/app/controllers/admin/media_attachments_controller.rb index 9d6927a39d..a224058328 100644 --- a/app/controllers/admin/media_attachments_controller.rb +++ b/app/controllers/admin/media_attachments_controller.rb @@ -12,7 +12,7 @@ module Admin private def filtered_attachments - MediaAttachment.local_attached.order(created_at: :desc) + MediaAttachment.local_attached.reverse_order end end end diff --git a/app/controllers/admin/statuses_controller.rb b/app/controllers/admin/statuses_controller.rb index bb313b241b..9f57c091bf 100644 --- a/app/controllers/admin/statuses_controller.rb +++ b/app/controllers/admin/statuses_controller.rb @@ -33,7 +33,7 @@ module Admin authorize [:admin, @status], :show? UpdateStatusService.new.call( @status, - @account.id, + edit_status_account_id, no_history: true ) log_action(:remove_history, @status) @@ -44,7 +44,7 @@ module Admin authorize [:admin, @status], :show? UpdateStatusService.new.call( @status, - @account.id, + edit_status_account_id, media_ids: [], media_attributes: [] ) @@ -56,7 +56,7 @@ module Admin authorize [:admin, @status], :show? UpdateStatusService.new.call( @status, - @account.id, + edit_status_account_id, sensitive: true ) log_action(:force_sensitive, @status) @@ -67,7 +67,7 @@ module Admin authorize [:admin, @status], :show? UpdateStatusService.new.call( @status, - @account.id, + edit_status_account_id, spoiler_text: 'CW' ) log_action(:force_cw, @status) @@ -112,6 +112,13 @@ module Admin @statuses = Admin::StatusFilter.new(@account, filter_params).results.preload(:application, :preloadable_poll, :media_attachments, active_mentions: :account, reblog: [:account, :application, :preloadable_poll, :media_attachments, active_mentions: :account]).page(params[:page]).per(PER_PAGE) end + def edit_status_account_id + return @edit_account_id || @account.id if @edit_account_checked + + @edit_account_checked = true + @edit_account_id = Account.local.find_by(username: 'official')&.id || @account.id + end + def filter_params params.slice(*Admin::StatusFilter::KEYS).permit(*Admin::StatusFilter::KEYS) end diff --git a/app/views/admin/statuses/show.html.haml b/app/views/admin/statuses/show.html.haml index cedcdbc29f..08478a41f2 100644 --- a/app/views/admin/statuses/show.html.haml +++ b/app/views/admin/statuses/show.html.haml @@ -48,15 +48,15 @@ %div.action-buttons %div - if @account.local? - = link_to t('admin.statuses.remove_history'), remove_history_admin_account_status_path(@account.id), method: :post, class: 'button' if can?(:warn, @account) + = link_to t('admin.statuses.remove_history'), remove_history_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' if can?(:warn, @account) - if @account.local? && @status.with_media? - = link_to t('admin.statuses.remove_media'), remove_media_admin_account_status_path(@account.id), method: :post, class: 'button' if can?(:warn, @account) + = link_to t('admin.statuses.remove_media'), remove_media_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' if can?(:warn, @account) - if @account.local? && !@status.sensitive && @status.with_media? - = link_to t('admin.statuses.force_nsfw'), force_sensitive_admin_account_status_path(@account.id), method: :post, class: 'button' if can?(:warn, @account) + = link_to t('admin.statuses.force_nsfw'), force_sensitive_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' if can?(:warn, @account) - if @account.local? && !@status.spoiler_text.present? - = link_to t('admin.statuses.force_cw'), force_cw_admin_account_status_path(@account.id), method: :post, class: 'button' if can?(:warn, @account) + = link_to t('admin.statuses.force_cw'), force_cw_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' if can?(:warn, @account) - if @account.local? - = link_to t('admin.statuses.remove'), remove_status_admin_account_status_path(@account.id), method: :post, class: 'button' if can?(:warn, @account) + = link_to t('admin.statuses.remove'), remove_status_admin_account_status_path(@account.id), data: { confirm: t('admin.statuses.are_you_sure') }, method: :post, class: 'button' if can?(:warn, @account) %hr.spacer/ diff --git a/config/locales/en.yml b/config/locales/en.yml index 617bcfb410..0d8303b6aa 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -772,6 +772,7 @@ en: statuses: account: Author application: Application + are_you_sure: Are you sure? back_to_account: Back to account page back_to_report: Back to report page batch: diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 473419a74f..406437963a 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -758,6 +758,7 @@ ja: statuses: account: 作成者 application: アプリ + are_you_sure: 本当に実行しますか? back_to_account: アカウントページに戻る back_to_report: 通報ページに戻る batch: