Revert "Upstream 20240517"
This commit is contained in:
parent
9c006fd893
commit
f6dec44e95
2347 changed files with 26470 additions and 87494 deletions
|
@ -4,7 +4,7 @@ module Admin
|
|||
class StatusesController < BaseController
|
||||
before_action :set_account
|
||||
before_action :set_statuses, except: :show
|
||||
before_action :set_status, only: [:show, :remove_history, :remove_media, :force_sensitive, :force_cw, :remove_status]
|
||||
before_action :set_status, only: :show
|
||||
|
||||
PER_PAGE = 20
|
||||
|
||||
|
@ -29,65 +29,6 @@ module Admin
|
|||
redirect_to after_create_redirect_path
|
||||
end
|
||||
|
||||
def remove_history
|
||||
authorize [:admin, @status], :show?
|
||||
UpdateStatusService.new.call(
|
||||
@status,
|
||||
edit_status_account_id,
|
||||
no_history: true,
|
||||
bypass_validation: true
|
||||
)
|
||||
log_action(:remove_history, @status)
|
||||
redirect_to admin_account_status_path
|
||||
end
|
||||
|
||||
def remove_media
|
||||
authorize [:admin, @status], :show?
|
||||
UpdateStatusService.new.call(
|
||||
@status,
|
||||
edit_status_account_id,
|
||||
media_ids: [],
|
||||
media_attributes: [],
|
||||
bypass_validation: true
|
||||
)
|
||||
log_action(:remove_media, @status)
|
||||
redirect_to admin_account_status_path
|
||||
end
|
||||
|
||||
def force_sensitive
|
||||
authorize [:admin, @status], :show?
|
||||
UpdateStatusService.new.call(
|
||||
@status,
|
||||
edit_status_account_id,
|
||||
sensitive: true,
|
||||
bypass_validation: true
|
||||
)
|
||||
log_action(:force_sensitive, @status)
|
||||
redirect_to admin_account_status_path
|
||||
end
|
||||
|
||||
def force_cw
|
||||
authorize [:admin, @status], :show?
|
||||
UpdateStatusService.new.call(
|
||||
@status,
|
||||
edit_status_account_id,
|
||||
spoiler_text: 'CW',
|
||||
bypass_validation: true
|
||||
)
|
||||
log_action(:force_cw, @status)
|
||||
redirect_to admin_account_status_path
|
||||
end
|
||||
|
||||
def remove_status
|
||||
authorize [:admin, @status], :show?
|
||||
@status.discard_with_reblogs
|
||||
StatusPin.find_by(status: @status)&.destroy
|
||||
@status.account.statuses_count = @status.account.statuses_count - 1
|
||||
RemovalWorker.perform_async(@status.id, { 'redraft' => false })
|
||||
log_action(:remove_status, @status)
|
||||
redirect_to admin_account_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def batched_ordered_status_edits
|
||||
|
@ -121,13 +62,6 @@ 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.representative.id
|
||||
end
|
||||
|
||||
def filter_params
|
||||
params.slice(*Admin::StatusFilter::KEYS).permit(*Admin::StatusFilter::KEYS)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue