Skip non-collection urls in process links service (#38351)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
014e85ba9d
commit
0ef43a431d
@ -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 }
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user