about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-02-10 09:13:27 +0100
committerClaire <claire.github-309c@sitedethib.com>2022-02-10 19:10:14 +0100
commitabd113167b4f50d2ca6b938fcb52997ab6080b0b (patch)
treeb85d72f8667daa92a5e984e93ea30cd0ebc54cf5 /app/services
parentf1a6f9062e00c0651680bf4d5d750ec0b078ac5a (diff)
Add ability to change content-type when editing a toot
Content-type defaults to edited toot's content-type to avoid surprising
behaviors when using clients that do not support this feature.
Diffstat (limited to 'app/services')
-rw-r--r--app/services/update_status_service.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/services/update_status_service.rb b/app/services/update_status_service.rb
index 238ef0755..63bd27989 100644
--- a/app/services/update_status_service.rb
+++ b/app/services/update_status_service.rb
@@ -13,6 +13,7 @@ class UpdateStatusService < BaseService
   # @option options [String] :spoiler_text
   # @option options [Boolean] :sensitive
   # @option options [String] :language
+  # @option options [String] :content_type
   def call(status, account_id, options = {})
     @status                    = status
     @options                   = options
@@ -95,6 +96,7 @@ class UpdateStatusService < BaseService
     @status.spoiler_text = @options[:spoiler_text] || ''
     @status.sensitive    = @options[:sensitive] || @options[:spoiler_text].present?
     @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
 
     @status.save!