Add API support for setting status content-type

This commit is contained in:
Thibaut Girka 2019-05-12 20:15:39 +02:00 committed by ThibG
parent b3e68de4d2
commit 14d7ddcb1c
2 changed files with 3 additions and 0 deletions

View File

@ -54,6 +54,7 @@ class Api::V1::StatusesController < Api::BaseController
scheduled_at: status_params[:scheduled_at], scheduled_at: status_params[:scheduled_at],
application: doorkeeper_token.application, application: doorkeeper_token.application,
poll: status_params[:poll], poll: status_params[:poll],
content_type: status_params[:content_type],
idempotency: request.headers['Idempotency-Key']) idempotency: request.headers['Idempotency-Key'])
render json: @status, serializer: @status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer render json: @status, serializer: @status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer
@ -85,6 +86,7 @@ class Api::V1::StatusesController < Api::BaseController
:spoiler_text, :spoiler_text,
:visibility, :visibility,
:scheduled_at, :scheduled_at,
:content_type,
media_ids: [], media_ids: [],
poll: [ poll: [
:multiple, :multiple,

View File

@ -168,6 +168,7 @@ class PostStatusService < BaseService
visibility: @visibility, visibility: @visibility,
language: language_from_option(@options[:language]) || @account.user&.setting_default_language&.presence || LanguageDetector.instance.detect(@text, @account), language: language_from_option(@options[:language]) || @account.user&.setting_default_language&.presence || LanguageDetector.instance.detect(@text, @account),
application: @options[:application], application: @options[:application],
content_type: @options[:content_type],
}.compact }.compact
end end