diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-03-02 18:02:48 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-03-02 18:02:48 +0100 |
commit | 425a6c90c44a620e5015cd659cf5d8e3bf68ee07 (patch) | |
tree | 1bb889bca498b07dd4f3a56a5690ea9c2f602382 /app/services | |
parent | 0b8fe020b599341d78cc03431eb156485c70ebea (diff) | |
parent | 462a6f7d721fa0717c5627fd0f0d73ee9ec5a675 (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/approve_appeal_service.rb | 8 | ||||
-rw-r--r-- | app/services/update_status_service.rb | 10 |
2 files changed, 13 insertions, 5 deletions
diff --git a/app/services/approve_appeal_service.rb b/app/services/approve_appeal_service.rb index f76bf8943..37a08b46e 100644 --- a/app/services/approve_appeal_service.rb +++ b/app/services/approve_appeal_service.rb @@ -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 diff --git a/app/services/update_status_service.rb b/app/services/update_status_service.rb index 76530a54c..6cbbd2876 100644 --- a/app/services/update_status_service.rb +++ b/app/services/update_status_service.rb @@ -23,8 +23,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 @@ -92,9 +92,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.content_type = @options[:content_type] || @status.content_type @status.edited_at = Time.now.utc |