From 70763ef0ea6cb6b997ac144d8b4d855b16fb838c Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Sat, 25 Jul 2020 23:19:56 -0500 Subject: [Feature, Privacy] Add base support for per-domain post privacy --- app/services/process_mentions_service.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/services/process_mentions_service.rb') diff --git a/app/services/process_mentions_service.rb b/app/services/process_mentions_service.rb index 8b4b11617..9d219f3f6 100644 --- a/app/services/process_mentions_service.rb +++ b/app/services/process_mentions_service.rb @@ -21,6 +21,7 @@ class ProcessMentionsService < BaseService check_for_spam(status) + @activitypub_json = {} mentions.each { |mention| create_notification(mention) } end @@ -32,13 +33,12 @@ class ProcessMentionsService < BaseService if mentioned_account.local? LocalNotificationWorker.perform_async(mentioned_account.id, mention.id, mention.class.name) elsif mentioned_account.activitypub? && !@status.local_only? - ActivityPub::DeliveryWorker.perform_async(activitypub_json, mention.status.account_id, mentioned_account.inbox_url) + ActivityPub::DeliveryWorker.perform_async(activitypub_json(mentioned_account.domain), mention.status.account_id, mentioned_account.inbox_url) end end - def activitypub_json - return @activitypub_json if defined?(@activitypub_json) - @activitypub_json = Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(@status, embed: false), ActivityPub::ActivitySerializer, signer: @status.account)) + def activitypub_json(domain) + @activitypub_json[domain] ||= Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(@status, embed: false), ActivityPub::ActivitySerializer, signer: @status.account, target_domain: domain)) end def check_for_spam(status) -- cgit