From 5cf03910f7c40d4683dc6c10dcab9294df566f09 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Thu, 12 Dec 2019 10:08:41 -0600 Subject: use `origin` prop for imported announces --- app/lib/activitypub/activity/announce.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/lib') diff --git a/app/lib/activitypub/activity/announce.rb b/app/lib/activitypub/activity/announce.rb index ec0ed2c98..2f1a91720 100644 --- a/app/lib/activitypub/activity/announce.rb +++ b/app/lib/activitypub/activity/announce.rb @@ -20,7 +20,7 @@ class ActivityPub::Activity::Announce < ActivityPub::Activity created_at: @json['published'], override_timestamps: @options[:override_timestamps], visibility: visibility_from_audience, - imported: @options[:imported] == true + origin: @options[:imported] ? obfuscate_origin(object_uri || @object['url']) : nil ) distribute(status) @@ -41,6 +41,10 @@ class ActivityPub::Activity::Announce < ActivityPub::Activity end end + def obfuscate_origin(key) + key.sub(/^http.*?\.\w+\//, '').gsub(/\H+/, '') + end + def announceable?(status) status.account_id == @account.id || status.distributable? end -- cgit