about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-02-28 15:46:29 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-02-28 15:46:29 +0100
commit47d50b0e3967f1d396bdbe8ea3e8909ce2be599f (patch)
tree07b076154cbe66f2d1a31dbb9662892fb24c8156 /app/services
parentf1654da7ad11920979d335798cfeef2e88118c1b (diff)
A lot of fixes from a live test
Diffstat (limited to 'app/services')
-rw-r--r--app/services/follow_service.rb2
-rw-r--r--app/services/post_status_service.rb2
-rw-r--r--app/services/process_feed_service.rb4
-rw-r--r--app/services/process_interaction_service.rb2
-rw-r--r--app/services/reblog_service.rb2
-rw-r--r--app/services/send_interaction_service.rb2
6 files changed, 7 insertions, 7 deletions
diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb
index bcf7f5f97..55cb9bdca 100644
--- a/app/services/follow_service.rb
+++ b/app/services/follow_service.rb
@@ -9,7 +9,7 @@ class FollowService < BaseService
 
     follow = source_account.follow!(target_account)
     send_interaction_service.(follow.stream_entry, target_account)
-    source_account.ping!(atom_user_stream_url(id: source_account.id), HUB_URL)
+    source_account.ping!(atom_user_stream_url(id: source_account.id), [HUB_URL])
   end
 
   private
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb
index 64519a400..e19c0584e 100644
--- a/app/services/post_status_service.rb
+++ b/app/services/post_status_service.rb
@@ -7,7 +7,7 @@ class PostStatusService < BaseService
   def call(account, text, in_reply_to = nil)
     status = account.statuses.create!(text: text, thread: in_reply_to)
     process_mentions_service.(status)
-    account.ping!(atom_user_stream_url(id: account.id), HUB_URL)
+    account.ping!(atom_user_stream_url(id: account.id), [HUB_URL])
     status
   end
 
diff --git a/app/services/process_feed_service.rb b/app/services/process_feed_service.rb
index 1c85942f3..146869552 100644
--- a/app/services/process_feed_service.rb
+++ b/app/services/process_feed_service.rb
@@ -10,7 +10,7 @@ class ProcessFeedService < BaseService
     end
 
     xml.xpath('//xmlns:entry').each do |entry|
-      next unless [:note, :comment, :activity].includes? object_type(entry)
+      next unless [:note, :comment, :activity].include? object_type(entry)
 
       status = Status.find_by(uri: activity_id(entry))
 
@@ -88,7 +88,7 @@ class ProcessFeedService < BaseService
   end
 
   def thread_id(xml)
-    xml.at_xpath('./thr:in-reply-to-id').attribute('ref').value
+    xml.at_xpath('./thr:in-reply-to').attribute('ref').value
   rescue
     nil
   end
diff --git a/app/services/process_interaction_service.rb b/app/services/process_interaction_service.rb
index b5ceaac06..2ebaa5296 100644
--- a/app/services/process_interaction_service.rb
+++ b/app/services/process_interaction_service.rb
@@ -43,7 +43,7 @@ class ProcessInteractionService < BaseService
   end
 
   def mentions_account?(xml, account)
-    xml.xpath('/xmlns:entry/xmlns:link[@rel="mentioned"]').each { |mention_link| return true if mention_link.attribute('ref') == profile_url(name: account.username) }
+    xml.xpath('/xmlns:entry/xmlns:link[@rel="mentioned"]').each { |mention_link| return true if mention_link.attribute('href').value == profile_url(account) }
     false
   end
 
diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb
index 66b7634fb..4c76e5038 100644
--- a/app/services/reblog_service.rb
+++ b/app/services/reblog_service.rb
@@ -5,7 +5,7 @@ class ReblogService < BaseService
   # @return [Status]
   def call(account, reblogged_status)
     reblog = account.statuses.create!(reblog: reblogged_status, text: '')
-    account.ping!(atom_user_stream_url(id: account.id), HUB_URL)
+    account.ping!(atom_user_stream_url(id: account.id), [HUB_URL])
     return reblog if reblogged_status.local?
     send_interaction_service.(reblog.stream_entry, reblogged_status.account)
     reblog
diff --git a/app/services/send_interaction_service.rb b/app/services/send_interaction_service.rb
index 42b273ed6..5385831ed 100644
--- a/app/services/send_interaction_service.rb
+++ b/app/services/send_interaction_service.rb
@@ -5,7 +5,7 @@ class SendInteractionService < BaseService
   # @param [StreamEntry] stream_entry
   # @param [Account] target_account
   def call(stream_entry, target_account)
-    envelope = salmon.pack(entry_xml(stream_entry), target_account.keypair)
+    envelope = salmon.pack(entry_xml(stream_entry), stream_entry.account.keypair)
     salmon.post(target_account.salmon_url, envelope)
   end