From 679aa8a7f9bef42ee5d0b326d9ae4925a1999939 Mon Sep 17 00:00:00 2001 From: noellabo Date: Sat, 5 Sep 2020 15:12:53 +0900 Subject: [PATCH] Fix 14666 --- app/lib/activitypub/activity/create.rb | 2 +- app/services/concerns/payloadable.rb | 2 +- app/services/process_mentions_service.rb | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index 1ab239757d47c6..8ff4213d2908f0 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -365,7 +365,7 @@ def conversation_from_context uri = value_or_id(@object['context']) conversation ||= ActivityPub::TagManager.instance.uri_to_resource(uri, Conversation) - return conversation if (conversation.present? && conversation.uri == uri) || !uri.start_with?('https://') + return conversation if (conversation.present? && (conversation.local? || conversation.uri == uri)) || !uri.start_with?('https://') conversation_json = begin if @object['context'].is_a?(Hash) && !invalid_origin?(uri) diff --git a/app/services/concerns/payloadable.rb b/app/services/concerns/payloadable.rb index 3e45570c3468a2..2302534fa16e26 100644 --- a/app/services/concerns/payloadable.rb +++ b/app/services/concerns/payloadable.rb @@ -7,7 +7,7 @@ def serialize_payload(record, serializer, options = {}) payload = ActiveModelSerializers::SerializableResource.new(record, options.merge(serializer: serializer, adapter: ActivityPub::Adapter)).as_json object = record.respond_to?(:virtual_object) ? record.virtual_object : record - if (object.respond_to?(:sign?) && object.sign?) && signer && signing_enabled? + if (object.respond_to?(:sign?) && object.sign?) && signer && signing_enabled? || object.is_a?(String) ActivityPub::LinkedDataSignature.new(payload).sign!(signer, sign_with: sign_with) else payload diff --git a/app/services/process_mentions_service.rb b/app/services/process_mentions_service.rb index 16b432de926b0d..dea4a33f35dbde 100644 --- a/app/services/process_mentions_service.rb +++ b/app/services/process_mentions_service.rb @@ -56,8 +56,10 @@ def call(status, circle = nil) # need to send our reply to the remote author's inbox for distribution status.thread.mentions.includes(:account).find_each do |mention| - status.mentions.create(silent: true, account: mention.account) + status.mentions.create(silent: true, account: mention.account) unless status.account_id == mention.account_id end + + status.mentions.create(silent: true, account: status.thread.account) unless status.account_id == status.thread.account_id end status.save!