diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-12-12 10:08:41 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-12-12 10:08:41 -0600 |
commit | 5cf03910f7c40d4683dc6c10dcab9294df566f09 (patch) | |
tree | 6d99630913946098fad8c047f7b0175508bea0b7 /app/lib/activitypub/activity | |
parent | e52ed3b6e941ff4273e6491bf99fcba392e0d9e4 (diff) |
use `origin` prop for imported announces
Diffstat (limited to 'app/lib/activitypub/activity')
-rw-r--r-- | app/lib/activitypub/activity/announce.rb | 6 |
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 |