Add support for numeric IDs to local account lookup via URI

This commit is contained in:
Claire 2025-03-31 15:18:48 +02:00
parent 6e330d2b2a
commit 3661890e9f
2 changed files with 2 additions and 3 deletions

View File

@ -274,10 +274,9 @@ class ActivityPub::TagManager
path_params = Rails.application.routes.recognize_path(uri) path_params = Rails.application.routes.recognize_path(uri)
# TODO: handle numeric IDs
case path_params[:controller] case path_params[:controller]
when 'accounts' when 'accounts'
[:username, path_params[:username]] path_params.key?(:username) ? [:username, path_params[:username]] : [:id, path_params[:id]]
when 'instance_actors' when 'instance_actors'
[:id, -99] [:id, -99]
end end

View File

@ -6,7 +6,7 @@ RSpec.describe ActivityPub::SynchronizeFollowersService do
subject { described_class.new } subject { described_class.new }
let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account', inbox_url: 'http://example.com/inbox') } let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account', inbox_url: 'http://example.com/inbox') }
let(:alice) { Fabricate(:account, username: 'alice') } let(:alice) { Fabricate(:account, username: 'alice', id_scheme: :numeric_ap_id) }
let(:bob) { Fabricate(:account, username: 'bob') } let(:bob) { Fabricate(:account, username: 'bob') }
let(:eve) { Fabricate(:account, username: 'eve') } let(:eve) { Fabricate(:account, username: 'eve') }
let(:mallory) { Fabricate(:account, username: 'mallory') } let(:mallory) { Fabricate(:account, username: 'mallory') }