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:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user