Skip non-collection urls in process links service (#38351)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Matt Jankowski 2026-03-24 05:52:35 -04:00 committed by GitHub
parent 014e85ba9d
commit 0ef43a431d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -28,6 +28,7 @@ class ProcessLinksService < BaseService
# TODO: We probably want to resolve unknown objects at authoring time
object = ActivityPub::TagManager.instance.uri_to_resource(url.to_s, Collection)
next if object.nil?
tagged_object = @previous_objects.find { |x| x.object == object || x.uri == url }
tagged_object ||= @current_objects.find { |x| x.object == object || x.uri == url }

View File

@ -16,4 +16,13 @@ RSpec.describe ProcessLinksService do
.to change { status.tagged_objects.count }.by(1)
end
end
context 'when status has a generic link' do
let(:status) { Fabricate(:status, account: account, text: 'Hello check out my personal web page: https://example.com/test', visibility: :public) }
it 'skips the link and does not create a tagged object' do
expect { expect { subject.call(status) }.to_not raise_error }
.to not_change { status.tagged_objects.count }.from(0)
end
end
end