Fix #54 - Fetch remote accounts by URL from mentions
Fetching atom extracted from FetchRemoteAccountService and FetchRemoteStatusService into FetchAtomService. Mentions of the constant "http://activityschema.org/collection/public" skipped as it's not a real URL/user.
This commit is contained in:
parent
0bd4608ad1
commit
c6b0311b86
11 changed files with 99 additions and 67 deletions
|
@ -57,7 +57,11 @@ class ProcessFeedService < BaseService
|
|||
# and tidier
|
||||
|
||||
links.each do |mention_link|
|
||||
href = Addressable::URI.parse(mention_link.attribute('href').value)
|
||||
href_val = mention_link.attribute('href').value
|
||||
|
||||
next if href_val == 'http://activityschema.org/collection/public'
|
||||
|
||||
href = Addressable::URI.parse(href_val)
|
||||
|
||||
if href.host == Rails.configuration.x.local_domain
|
||||
# A local user is mentioned
|
||||
|
@ -72,6 +76,10 @@ class ProcessFeedService < BaseService
|
|||
# This is kinda dodgy because URLs could change, we don't index them
|
||||
mentioned_account = Account.find_by(url: href.to_s)
|
||||
|
||||
if mentioned_account.nil?
|
||||
mentioned_account = FetchRemoteAccountService.new.(href)
|
||||
end
|
||||
|
||||
unless mentioned_account.nil?
|
||||
mentioned_account.mentions.where(status: status).first_or_create(status: status)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue