From 50f7bcd05a29155c6cb22f0d4d2cecdd68a9831f Mon Sep 17 00:00:00 2001 From: noellabo Date: Mon, 24 Feb 2020 11:36:40 +0900 Subject: [PATCH] Fix boost target to be quoted if boosted --- app/services/post_status_service.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 854e1d874..accfcec21 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -26,10 +26,12 @@ class PostStatusService < BaseService @options = options @text = @options[:text] || '' @in_reply_to = @options[:thread] + @quote_id = @options[:quote_id] return idempotency_duplicate if idempotency_given? && idempotency_duplicate? validate_media! + preprocess_quote! preprocess_attributes! if scheduled? @@ -58,6 +60,13 @@ class PostStatusService < BaseService raise ActiveRecord::RecordInvalid 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! # The following transaction block is needed to wrap the UPDATEs to # 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), application: @options[:application], rate_limit: @options[:with_rate_limit], - quote_id: @options[:quote_id], + quote_id: @quote_id, }.compact end