diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-02-29 19:42:08 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-02-29 19:42:08 +0100 |
commit | 0e8f59c16fcb21301c736ecbc4424cb4c5388c42 (patch) | |
tree | 344ac1e0b2d165ba4fe3870f786e854710970ce1 /app/services | |
parent | 11ff92c9d7b27c2c9ed86f649aef8d956cc8b989 (diff) |
Refactoring Grape API methods into normal controllers & other things
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/base_service.rb | 1 | ||||
-rw-r--r-- | app/services/follow_remote_account_service.rb | 2 | ||||
-rw-r--r-- | app/services/follow_service.rb | 2 | ||||
-rw-r--r-- | app/services/post_status_service.rb | 2 | ||||
-rw-r--r-- | app/services/process_interaction_service.rb | 2 | ||||
-rw-r--r-- | app/services/reblog_service.rb | 2 | ||||
-rw-r--r-- | app/services/send_interaction_service.rb | 2 |
7 files changed, 7 insertions, 6 deletions
diff --git a/app/services/base_service.rb b/app/services/base_service.rb index 0816b3503..c89d6eabc 100644 --- a/app/services/base_service.rb +++ b/app/services/base_service.rb @@ -1,3 +1,4 @@ class BaseService + include RoutingHelper include ApplicationHelper end diff --git a/app/services/follow_remote_account_service.rb b/app/services/follow_remote_account_service.rb index f52a3a222..2f842e329 100644 --- a/app/services/follow_remote_account_service.rb +++ b/app/services/follow_remote_account_service.rb @@ -38,7 +38,7 @@ class FollowRemoteAccountService < BaseService account.secret = SecureRandom.hex account.verify_token = SecureRandom.hex - subscription = account.subscription(subscription_url(account)) + subscription = account.subscription(api_subscription_url(account.id)) subscription.subscribe account.save! diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb index 55cb9bdca..b0bfdf4f2 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!(account_url(account, format: 'atom'), [HUB_URL]) end private diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index e19c0584e..aa25de4dc 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!(account_url(account, format: 'atom'), [HUB_URL]) status end diff --git a/app/services/process_interaction_service.rb b/app/services/process_interaction_service.rb index 2ebaa5296..30cf5a771 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('href').value == profile_url(account) } + xml.xpath('/xmlns:entry/xmlns:link[@rel="mentioned"]').each { |mention_link| return true if mention_link.attribute('href').value == url_for_target(account) } false end diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb index 4c76e5038..e3e091fa7 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!(account_url(account, format: 'atom'), [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 5385831ed..e6708498f 100644 --- a/app/services/send_interaction_service.rb +++ b/app/services/send_interaction_service.rb @@ -1,5 +1,5 @@ class SendInteractionService < BaseService - include AtomHelper + include AtomBuilderHelper # Send an Atom representation of an interaction to a remote Salmon endpoint # @param [StreamEntry] stream_entry |