From 920d25f8c9600a6ef4bbff2c642085921e6fcd23 Mon Sep 17 00:00:00 2001 From: Surinna Curtis Date: Sun, 17 Dec 2017 04:57:44 +0000 Subject: [PATCH] Handle local_only param when creating statuses. --- app/controllers/api/v1/statuses_controller.rb | 3 ++- app/services/post_status_service.rb | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 544a4ce218..8eb83fbab5 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -42,6 +42,7 @@ class Api::V1::StatusesController < Api::BaseController @status = PostStatusService.new.call(current_user.account, status_params[:status], status_params[:in_reply_to_id].blank? ? nil : Status.find(status_params[:in_reply_to_id]), + local_only: status_params[:local_only], media_ids: status_params[:media_ids], sensitive: status_params[:sensitive], spoiler_text: status_params[:spoiler_text], @@ -72,7 +73,7 @@ class Api::V1::StatusesController < Api::BaseController end def status_params - params.permit(:status, :in_reply_to_id, :sensitive, :spoiler_text, :visibility, media_ids: []) + params.permit(:status, :in_reply_to_id, :local_only, :sensitive, :spoiler_text, :visibility, media_ids: []) end def pagination_params(core_params) diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 6b6a37676a..bebfa3b01e 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -6,6 +6,7 @@ class PostStatusService < BaseService # @param [String] text Message # @param [Status] in_reply_to Optional status to reply to # @param [Hash] options + # @option [Boolean] :local_only # @option [Boolean] :sensitive # @option [String] :visibility # @option [String] :spoiler_text @@ -25,6 +26,7 @@ class PostStatusService < BaseService ApplicationRecord.transaction do status = account.statuses.create!(text: text, thread: in_reply_to, + local_only: options[:local_only], sensitive: options[:sensitive], spoiler_text: options[:spoiler_text] || '', visibility: options[:visibility] || account.user&.setting_default_privacy,