about summary refs log tree commit diff
path: root/app/services/process_feed_service.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-26 16:42:38 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-26 16:44:40 +0200
commitc6b0311b8626b42bc7e79e0195047a50e5b64dd1 (patch)
treee68f4b6922de5ec6277de7bc76b2bdb47a8c3e89 /app/services/process_feed_service.rb
parent0bd4608ad1b29328f04fcad6e7a20ef61668d239 (diff)
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.
Diffstat (limited to 'app/services/process_feed_service.rb')
-rw-r--r--app/services/process_feed_service.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/services/process_feed_service.rb b/app/services/process_feed_service.rb
index 5e760bc75..47992b246 100644
--- a/app/services/process_feed_service.rb
+++ b/app/services/process_feed_service.rb
@@ -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