about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-10 19:09:11 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-10 19:16:23 +0200
commit77efdfa1104a77061f014bbc84268028597620cb (patch)
tree64cbd7674bc70fa2d384b58b6331da40ab041176 /app
parent451733961b6499edafbbb6bae206671e564b31b8 (diff)
Fixing namespaces issue
Diffstat (limited to 'app')
-rw-r--r--app/services/process_feed_service.rb12
-rw-r--r--app/services/process_interaction_service.rb2
2 files changed, 7 insertions, 7 deletions
diff --git a/app/services/process_feed_service.rb b/app/services/process_feed_service.rb
index 334cde6b1..cd9bd8e93 100644
--- a/app/services/process_feed_service.rb
+++ b/app/services/process_feed_service.rb
@@ -45,7 +45,7 @@ class ProcessFeedService < BaseService
     # Also record all media attachments for the status and for the reblogged status if present
     unless status.new_record?
       record_remote_mentions(status, entry.xpath('./xmlns:link[@rel="mentioned"]'))
-      record_remote_mentions(status.reblog, entry.xpath('./activity:object/xmlns:link[@rel="mentioned"]', activity: ACTIVITY_NS)) if status.reblog?
+      record_remote_mentions(status.reblog, entry.at_xpath('./activity:object', activity: ACTIVITY_NS).xpath('./xmlns:link[@rel="mentioned"]')) if status.reblog?
 
       process_attachments(entry, status)
       process_attachments(entry.xpath('./activity:object', activity: ACTIVITY_NS), status.reblog) if status.reblog?
@@ -147,8 +147,8 @@ class ProcessFeedService < BaseService
   end
 
   def fetch_remote_status(xml)
-    username = xml.at_xpath('./activity:object/xmlns:author/xmlns:name', activity: ACTIVITY_NS).content
-    url      = xml.at_xpath('./activity:object/xmlns:author/xmlns:uri', activity: ACTIVITY_NS).content
+    username = xml.at_xpath('./activity:object', activity: ACTIVITY_NS).at_xpath('./xmlns:author/xmlns:name').content
+    url      = xml.at_xpath('./activity:object', activity: ACTIVITY_NS).at_xpath('./xmlns:author/xmlns:uri').content
     domain   = Addressable::URI.parse(url).host
     account  = Account.find_remote(username, domain)
 
@@ -193,7 +193,7 @@ class ProcessFeedService < BaseService
   end
 
   def target_id(xml)
-    xml.at_xpath('.//activity:object/xmlns:id', activity: ACTIVITY_NS).content
+    xml.at_xpath('.//activity:object', activity: ACTIVITY_NS).at_xpath('./xmlns:id').content
   rescue
     nil
   end
@@ -209,11 +209,11 @@ class ProcessFeedService < BaseService
   end
 
   def target_content(xml)
-    xml.at_xpath('.//activity:object/xmlns:content', activity: ACTIVITY_NS).content
+    xml.at_xpath('.//activity:object', activity: ACTIVITY_NS).at_xpath('./xmlns:content').content
   end
 
   def target_url(xml)
-    xml.at_xpath('.//activity:object/xmlns:link[@rel="alternate"]', activity: ACTIVITY_NS).attribute('href').value
+    xml.at_xpath('.//activity:object').at_xpath('./xmlns:link[@rel="alternate"]', activity: ACTIVITY_NS).attribute('href').value
   end
 
   def object_type(xml)
diff --git a/app/services/process_interaction_service.rb b/app/services/process_interaction_service.rb
index 20ce3d00e..06c8f66d2 100644
--- a/app/services/process_interaction_service.rb
+++ b/app/services/process_interaction_service.rb
@@ -94,7 +94,7 @@ class ProcessInteractionService < BaseService
   end
 
   def activity_id(xml)
-    xml.at_xpath('//activity:object/xmlns:id', activity: ACTIVITY_NS).content
+    xml.at_xpath('//activity:object', activity: ACTIVITY_NS).at_xpath('./xmlns:id').content
   end
 
   def salmon