diff options
author | Jenkins <jenkins@jenkins.ninjawedding.org> | 2018-03-25 15:17:21 +0000 |
---|---|---|
committer | Jenkins <jenkins@jenkins.ninjawedding.org> | 2018-03-25 15:17:21 +0000 |
commit | 837b3804bfed9db1cf92923c4f6202aa7117d408 (patch) | |
tree | c8b5a921754a6b40227364225002332b54d0d0dd /app/workers/pubsubhubbub/confirmation_worker.rb | |
parent | 995b59526b06e1f949cba59d76e5e2718a1674f6 (diff) | |
parent | 85a395fab6d7077a252bfe6f96673931ea3aa5ee (diff) |
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'app/workers/pubsubhubbub/confirmation_worker.rb')
-rw-r--r-- | app/workers/pubsubhubbub/confirmation_worker.rb | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/app/workers/pubsubhubbub/confirmation_worker.rb b/app/workers/pubsubhubbub/confirmation_worker.rb index e1ccfb99c..cc2d1225b 100644 --- a/app/workers/pubsubhubbub/confirmation_worker.rb +++ b/app/workers/pubsubhubbub/confirmation_worker.rb @@ -21,8 +21,8 @@ class Pubsubhubbub::ConfirmationWorker def process_confirmation prepare_subscription - confirm_callback - logger.debug "Confirming PuSH subscription for #{subscription.callback_url} with challenge #{challenge}: #{callback_response_body}" + callback_get_with_params + logger.debug "Confirming PuSH subscription for #{subscription.callback_url} with challenge #{challenge}: #{@callback_response_body}" update_subscription end @@ -44,7 +44,7 @@ class Pubsubhubbub::ConfirmationWorker end def response_matches_challenge? - callback_response_body == challenge + @callback_response_body == challenge end def subscribing? @@ -55,16 +55,10 @@ class Pubsubhubbub::ConfirmationWorker mode == 'unsubscribe' end - def confirm_callback - @_confirm_callback ||= callback_get_with_params - end - def callback_get_with_params - Request.new(:get, subscription.callback_url, params: callback_params).perform - end - - def callback_response_body - confirm_callback.body.to_s + Request.new(:get, subscription.callback_url, params: callback_params).perform do |response| + @callback_response_body = response.body.to_s + end end def callback_params |