about summary refs log tree commit diff
path: root/app/services/update_status_service.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-03-01 22:20:29 +0100
committerGitHub <noreply@github.com>2022-03-01 22:20:29 +0100
commit25d3dc4373531071f444d8e44e44cd21970cb373 (patch)
treec58f2e336ebdc3e15de07395bde6dd3ed80a4e24 /app/services/update_status_service.rb
parent14919fe11e9a1dd5cbf12969a2957d0d05bb0534 (diff)
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
Diffstat (limited to 'app/services/update_status_service.rb')
-rw-r--r--app/services/update_status_service.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/services/update_status_service.rb b/app/services/update_status_service.rb
index 238ef0755..93203bc49 100644
--- a/app/services/update_status_service.rb
+++ b/app/services/update_status_service.rb
@@ -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