From a4caa7eb6258ff7f8eea8e6791b86b1c7f4d172e Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 8 Sep 2017 12:00:17 +0200 Subject: Fetch statuses/following/followers numbers from ActivityPub collections (#4840) --- spec/services/activitypub/fetch_remote_account_service_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/services') diff --git a/spec/services/activitypub/fetch_remote_account_service_spec.rb b/spec/services/activitypub/fetch_remote_account_service_spec.rb index 391d051c1..ed7e9bba8 100644 --- a/spec/services/activitypub/fetch_remote_account_service_spec.rb +++ b/spec/services/activitypub/fetch_remote_account_service_spec.rb @@ -41,7 +41,7 @@ RSpec.describe ActivityPub::FetchRemoteAccountService do before do actor[:inbox] = nil - + stub_request(:get, 'https://example.com/alice').to_return(body: Oj.dump(actor)) stub_request(:get, 'https://example.com/.well-known/webfinger?resource=acct:alice@example.com').to_return(body: Oj.dump(webfinger), headers: { 'Content-Type': 'application/jrd+json' }) end -- cgit From 90712d42933efd9978e4bbae82f81a4650aa4d84 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 9 Sep 2017 17:36:27 +0200 Subject: Fix errors preventing UnsubscribeService from working (#4866) --- app/services/unsubscribe_service.rb | 13 ++++++++----- spec/services/unsubscribe_service_spec.rb | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'spec/services') diff --git a/app/services/unsubscribe_service.rb b/app/services/unsubscribe_service.rb index 865f783bc..b99046712 100644 --- a/app/services/unsubscribe_service.rb +++ b/app/services/unsubscribe_service.rb @@ -4,16 +4,19 @@ class UnsubscribeService < BaseService def call(account) return if account.hub_url.blank? - @account = account - @response = build_request.perform + @account = account - Rails.logger.debug "PuSH unsubscribe for #{@account.acct} failed: #{@response.status}" unless @response.status.success? + begin + @response = build_request.perform + + Rails.logger.debug "PuSH unsubscribe for #{@account.acct} failed: #{@response.status}" unless @response.status.success? + rescue HTTP::Error, OpenSSL::SSL::SSLError => e + Rails.logger.debug "PuSH unsubscribe for #{@account.acct} failed: #{e}" + end @account.secret = '' @account.subscription_expires_at = nil @account.save! - rescue HTTP::Error, OpenSSL::SSL::SSLError - Rails.logger.debug "PuSH subscription request for #{@account.acct} could not be made due to HTTP or SSL error" end private diff --git a/spec/services/unsubscribe_service_spec.rb b/spec/services/unsubscribe_service_spec.rb index c81772037..2a02f4c75 100644 --- a/spec/services/unsubscribe_service_spec.rb +++ b/spec/services/unsubscribe_service_spec.rb @@ -26,7 +26,7 @@ RSpec.describe UnsubscribeService do stub_request(:post, 'http://hub.example.com/').to_raise(HTTP::Error) subject.call(account) - expect(logger).to have_received(:debug).with(/PuSH subscription request for bob@example.com could not be made due to HTTP or SSL error/) + expect(logger).to have_received(:debug).with(/unsubscribe for bob@example.com failed/) end def stub_logger -- cgit