Fix boost target to be quoted if boosted

This commit is contained in:
noellabo 2020-02-24 11:36:40 +09:00
parent fa350fdb2c
commit 2edc7f287e

View file

@ -26,10 +26,12 @@ class PostStatusService < BaseService
@options = options @options = options
@text = @options[:text] || '' @text = @options[:text] || ''
@in_reply_to = @options[:thread] @in_reply_to = @options[:thread]
@quote_id = @options[:quote_id]
return idempotency_duplicate if idempotency_given? && idempotency_duplicate? return idempotency_duplicate if idempotency_given? && idempotency_duplicate?
validate_media! validate_media!
preprocess_quote!
preprocess_attributes! preprocess_attributes!
if scheduled? if scheduled?
@ -58,6 +60,13 @@ class PostStatusService < BaseService
raise ActiveRecord::RecordInvalid raise ActiveRecord::RecordInvalid
end end
def preprocess_quote!
if @quote_id.present?
quote = Status.find(@quote_id)
@quote_id = quote.reblog_of_id.to_s if quote.reblog?
end
end
def process_status! def process_status!
# The following transaction block is needed to wrap the UPDATEs to # The following transaction block is needed to wrap the UPDATEs to
# the media attachments when the status is created # the media attachments when the status is created
@ -164,7 +173,7 @@ class PostStatusService < BaseService
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],
rate_limit: @options[:with_rate_limit], rate_limit: @options[:with_rate_limit],
quote_id: @options[:quote_id], quote_id: @quote_id,
}.compact }.compact
end end