about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/lib/activitypub/activity/announce.rb6
1 files changed, 5 insertions, 1 deletions
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