Fixing namespaces issue

signup-info-prompt
Eugen Rochko 2016-10-10 19:09:11 +02:00
parent 451733961b
commit 77efdfa110
2 changed files with 7 additions and 7 deletions

View File

@ -45,7 +45,7 @@ class ProcessFeedService < BaseService
# Also record all media attachments for the status and for the reblogged status if present # Also record all media attachments for the status and for the reblogged status if present
unless status.new_record? unless status.new_record?
record_remote_mentions(status, entry.xpath('./xmlns:link[@rel="mentioned"]')) 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, status)
process_attachments(entry.xpath('./activity:object', activity: ACTIVITY_NS), status.reblog) if status.reblog? process_attachments(entry.xpath('./activity:object', activity: ACTIVITY_NS), status.reblog) if status.reblog?
@ -147,8 +147,8 @@ class ProcessFeedService < BaseService
end end
def fetch_remote_status(xml) def fetch_remote_status(xml)
username = xml.at_xpath('./activity:object/xmlns:author/xmlns:name', 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/xmlns:author/xmlns:uri', activity: ACTIVITY_NS).content url = xml.at_xpath('./activity:object', activity: ACTIVITY_NS).at_xpath('./xmlns:author/xmlns:uri').content
domain = Addressable::URI.parse(url).host domain = Addressable::URI.parse(url).host
account = Account.find_remote(username, domain) account = Account.find_remote(username, domain)
@ -193,7 +193,7 @@ class ProcessFeedService < BaseService
end end
def target_id(xml) 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 rescue
nil nil
end end
@ -209,11 +209,11 @@ class ProcessFeedService < BaseService
end end
def target_content(xml) 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 end
def target_url(xml) 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 end
def object_type(xml) def object_type(xml)

View File

@ -94,7 +94,7 @@ class ProcessInteractionService < BaseService
end end
def activity_id(xml) 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 end
def salmon def salmon