]> cat aescling's git repositories - mastodon.git/commitdiff
Add API support for setting status content-type
authorThibaut Girka <thib@sitedethib.com>
Sun, 12 May 2019 18:15:39 +0000 (20:15 +0200)
committerThibG <thib@sitedethib.com>
Fri, 17 May 2019 21:51:14 +0000 (23:51 +0200)
app/controllers/api/v1/statuses_controller.rb
app/services/post_status_service.rb

index b0e134554f81292dc231dc620a2c9f8234b35a8e..26a0ab457323fac4e9d59d9b48e2caa560d04fc7 100644 (file)
@@ -54,6 +54,7 @@ class Api::V1::StatusesController < Api::BaseController
                                          scheduled_at: status_params[:scheduled_at],
                                          application: doorkeeper_token.application,
                                          poll: status_params[:poll],
+                                         content_type: status_params[:content_type],
                                          idempotency: request.headers['Idempotency-Key'])
 
     render json: @status, serializer: @status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer
@@ -85,6 +86,7 @@ class Api::V1::StatusesController < Api::BaseController
       :spoiler_text,
       :visibility,
       :scheduled_at,
+      :content_type,
       media_ids: [],
       poll: [
         :multiple,
index d2cca145b5430e017815c7d98fd9d992e56c4376..25aa6629c7762c85e41ebc97c073954180557a42 100644 (file)
@@ -168,6 +168,7 @@ class PostStatusService < BaseService
       visibility: @visibility,
       language: language_from_option(@options[:language]) || @account.user&.setting_default_language&.presence || LanguageDetector.instance.detect(@text, @account),
       application: @options[:application],
+      content_type: @options[:content_type],
     }.compact
   end