Add ability to mark statuses as sensitive from reports in admin UI (#17668)
* Add ability to mark statuses as sensitive from reports in admin UI * Allow mark as sensitive action on statuses with preview cards
This commit is contained in:
parent
14919fe11e
commit
25d3dc4373
9 changed files with 81 additions and 16 deletions
|
@ -27,6 +27,8 @@ class ApproveAppealService < BaseService
|
|||
undo_disable!
|
||||
when 'delete_statuses'
|
||||
undo_delete_statuses!
|
||||
when 'mark_statuses_as_sensitive'
|
||||
undo_mark_statuses_as_sensitive!
|
||||
when 'sensitive'
|
||||
undo_sensitive!
|
||||
when 'silence'
|
||||
|
@ -49,6 +51,12 @@ class ApproveAppealService < BaseService
|
|||
# Cannot be undone
|
||||
end
|
||||
|
||||
def undo_mark_statuses_as_sensitive!
|
||||
@strike.statuses.includes(:media_attachments).each do |status|
|
||||
UpdateStatusService.new.call(status, @current_account.id, sensitive: false) if status.with_media?
|
||||
end
|
||||
end
|
||||
|
||||
def undo_sensitive!
|
||||
target_account.unsensitize!
|
||||
end
|
||||
|
|
|
@ -22,8 +22,8 @@ class UpdateStatusService < BaseService
|
|||
|
||||
Status.transaction do
|
||||
create_previous_edit!
|
||||
update_media_attachments!
|
||||
update_poll!
|
||||
update_media_attachments! if @options.key?(:media_ids)
|
||||
update_poll! if @options.key?(:poll)
|
||||
update_immediate_attributes!
|
||||
create_edit!
|
||||
end
|
||||
|
@ -91,9 +91,9 @@ class UpdateStatusService < BaseService
|
|||
end
|
||||
|
||||
def update_immediate_attributes!
|
||||
@status.text = @options[:text].presence || @options.delete(:spoiler_text) || ''
|
||||
@status.spoiler_text = @options[:spoiler_text] || ''
|
||||
@status.sensitive = @options[:sensitive] || @options[:spoiler_text].present?
|
||||
@status.text = @options[:text].presence || @options.delete(:spoiler_text) || '' if @options.key?(:text)
|
||||
@status.spoiler_text = @options[:spoiler_text] || '' if @options.key?(:spoiler_text)
|
||||
@status.sensitive = @options[:sensitive] || @options[:spoiler_text].present? if @options.key?(:sensitive) || @options.key?(:spoiler_text)
|
||||
@status.language = valid_locale_or_nil(@options[:language] || @status.language || @status.account.user&.preferred_posting_language || I18n.default_locale)
|
||||
@status.edited_at = Time.now.utc
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue