From 66c640fd38d46ce844f245c5596d161dbf813554 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sat, 20 Apr 2019 20:57:41 -0500 Subject: [PATCH] Allow sharekeys to be set via the API. --- app/controllers/api/v1/statuses_controller.rb | 2 ++ app/services/post_status_service.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 26a0ab457..52d0fb9bc 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -52,6 +52,7 @@ class Api::V1::StatusesController < Api::BaseController spoiler_text: status_params[:spoiler_text], visibility: status_params[:visibility], scheduled_at: status_params[:scheduled_at], + sharekey: status_params[:sharekey], application: doorkeeper_token.application, poll: status_params[:poll], content_type: status_params[:content_type], @@ -85,6 +86,7 @@ class Api::V1::StatusesController < Api::BaseController :sensitive, :spoiler_text, :visibility, + :sharekey, :scheduled_at, :content_type, media_ids: [], diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 97ba26ddc..9ac38ca4a 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -12,6 +12,7 @@ class PostStatusService < BaseService # @option [Status] :thread Optional status to reply to # @option [Boolean] :sensitive # @option [String] :visibility + # @option [String] :sharekey # @option [String] :spoiler_text # @option [String] :language # @option [String] :scheduled_at @@ -166,6 +167,7 @@ class PostStatusService < BaseService sensitive: (@options[:sensitive].nil? ? @account.user&.setting_default_sensitive : @options[:sensitive]) || @options[:spoiler_text].present?, spoiler_text: @options[:spoiler_text] || '', visibility: @visibility, + sharekey: @sharekey, 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] || @account.user&.setting_default_content_type,