about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-03-22 17:36:34 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-03-22 17:36:34 +0100
commit5aa3df017bcdefd15e041ca0a7e428f85887aff2 (patch)
treeabc1029d770ca1ed1dec9f043250e814628ead8f /app/services
parentc89ccbab09696dc4d1de486417cccfd2ad5f30a0 (diff)
Fix full-text search query quotation, improve tag search performance with an index,
add ability to open status by URL from search (fix #53)
Diffstat (limited to 'app/services')
-rw-r--r--app/services/fetch_remote_account_service.rb9
-rw-r--r--app/services/fetch_remote_resource_service.rb4
-rw-r--r--app/services/fetch_remote_status_service.rb9
3 files changed, 16 insertions, 6 deletions
diff --git a/app/services/fetch_remote_account_service.rb b/app/services/fetch_remote_account_service.rb
index baefa3a86..6a6a696d6 100644
--- a/app/services/fetch_remote_account_service.rb
+++ b/app/services/fetch_remote_account_service.rb
@@ -1,8 +1,13 @@
 # frozen_string_literal: true
 
 class FetchRemoteAccountService < BaseService
-  def call(url)
-    atom_url, body = FetchAtomService.new.call(url)
+  def call(url, prefetched_body = nil)
+    if prefetched_body.nil?
+      atom_url, body = FetchAtomService.new.call(url)
+    else
+      atom_url = url
+      body     = prefetched_body
+    end
 
     return nil if atom_url.nil?
     process_atom(atom_url, body)
diff --git a/app/services/fetch_remote_resource_service.rb b/app/services/fetch_remote_resource_service.rb
index 80aa74365..2185ceb20 100644
--- a/app/services/fetch_remote_resource_service.rb
+++ b/app/services/fetch_remote_resource_service.rb
@@ -10,9 +10,9 @@ class FetchRemoteResourceService < BaseService
     xml.encoding = 'utf-8'
 
     if xml.root.name == 'feed'
-      FetchRemoteAccountService.new.call(atom_url)
+      FetchRemoteAccountService.new.call(atom_url, body)
     elsif xml.root.name == 'entry'
-      FetchRemoteStatusService.new.call(atom_url)
+      FetchRemoteStatusService.new.call(atom_url, body)
     end
   end
 end
diff --git a/app/services/fetch_remote_status_service.rb b/app/services/fetch_remote_status_service.rb
index 7063231e4..e2d185723 100644
--- a/app/services/fetch_remote_status_service.rb
+++ b/app/services/fetch_remote_status_service.rb
@@ -1,8 +1,13 @@
 # frozen_string_literal: true
 
 class FetchRemoteStatusService < BaseService
-  def call(url)
-    atom_url, body = FetchAtomService.new.call(url)
+  def call(url, prefetched_body = nil)
+    if prefetched_body.nil?
+      atom_url, body = FetchAtomService.new.call(url)
+    else
+      atom_url = url
+      body     = prefetched_body
+    end
 
     return nil if atom_url.nil?
     process_atom(atom_url, body)