From 803fba1d3adee6fe26efff42784796dc65f3425c Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 31 Oct 2024 17:43:58 +0100 Subject: [PATCH] [WiP] Fix some hardcoded routes in ActivityPub URI generation --- app/lib/activitypub/tag_manager.rb | 4 ++-- app/serializers/activitypub/actor_serializer.rb | 2 +- app/serializers/webfinger_serializer.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/lib/activitypub/tag_manager.rb b/app/lib/activitypub/tag_manager.rb index 23b44be372..f7f2d18618 100644 --- a/app/lib/activitypub/tag_manager.rb +++ b/app/lib/activitypub/tag_manager.rb @@ -99,7 +99,7 @@ class ActivityPub::TagManager when 'public' [COLLECTIONS[:public]] when 'unlisted', 'private' - [account_followers_url(status.account)] + [followers_uri_for(status.account)] when 'direct', 'limited' if status.account.silenced? # Only notify followers if the account is locally silenced @@ -133,7 +133,7 @@ class ActivityPub::TagManager case status.visibility when 'public' - cc << account_followers_url(status.account) + cc << followers_uri_for(status.account) when 'unlisted' cc << COLLECTIONS[:public] end diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb index f698e758e8..02d54ca9f3 100644 --- a/app/serializers/activitypub/actor_serializer.rb +++ b/app/serializers/activitypub/actor_serializer.rb @@ -44,7 +44,7 @@ class ActivityPub::ActorSerializer < ActivityPub::Serializer delegate :suspended?, :instance_actor?, to: :object def id - object.instance_actor? ? instance_actor_url : account_url(object) + ActivityPub::TagManager.instance.uri_for(object) end def type diff --git a/app/serializers/webfinger_serializer.rb b/app/serializers/webfinger_serializer.rb index b67cd2771a..1cb3175c07 100644 --- a/app/serializers/webfinger_serializer.rb +++ b/app/serializers/webfinger_serializer.rb @@ -13,7 +13,7 @@ class WebfingerSerializer < ActiveModel::Serializer if object.instance_actor? [instance_actor_url] else - [short_account_url(object), account_url(object)] + [short_account_url(object), ActivityPub::TagManager.instance.uri_for(object)] end end @@ -43,6 +43,6 @@ class WebfingerSerializer < ActiveModel::Serializer end def self_href - object.instance_actor? ? instance_actor_url : account_url(object) + ActivityPub::TagManager.instance.uri_for(object) end end