parent
90438e9b2e
commit
1f84b98292
@ -23,14 +23,14 @@ class ProcessLinksService < BaseService
|
|||||||
def scan_text!
|
def scan_text!
|
||||||
urls = @status.text.scan(FetchLinkCardService::URL_PATTERN).map { |array| Addressable::URI.parse(array[1]).normalize }
|
urls = @status.text.scan(FetchLinkCardService::URL_PATTERN).map { |array| Addressable::URI.parse(array[1]).normalize }
|
||||||
|
|
||||||
domains = urls.map(&:domain).uniq
|
domains = urls.map(&:host).uniq
|
||||||
valid_domains = Instance.searchable.where(domain: domains).pluck(:domain)
|
valid_domains = Instance.searchable.where(domain: domains).pluck(:domain)
|
||||||
|
|
||||||
urls.each do |url|
|
urls.each do |url|
|
||||||
# We only support `FeaturedCollection` at this time
|
# We only support `FeaturedCollection` at this time
|
||||||
|
|
||||||
object = ActivityPub::TagManager.instance.uri_to_resource(url.to_s, Collection)
|
object = ActivityPub::TagManager.instance.uri_to_resource(url.to_s, Collection)
|
||||||
object ||= ResolveURLService.new.call(url.to_s) if valid_domains.include?(url.domain)
|
object ||= ResolveURLService.new.call(url.to_s) if valid_domains.include?(url.host)
|
||||||
next unless object.is_a?(Collection)
|
next unless object.is_a?(Collection)
|
||||||
|
|
||||||
tagged_object = @previous_objects.find { |x| x.object == object || x.uri == url }
|
tagged_object = @previous_objects.find { |x| x.object == object || x.uri == url }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user