mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-23 08:34:13 -05:00
Handle local_only param when creating statuses.
This commit is contained in:
parent
578438b360
commit
920d25f8c9
@ -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)
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user