From 65ae9637d6cc7a9d351e8f83993ef138a01b1485 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 10 Oct 2016 03:40:08 +0200 Subject: [PATCH] PuSH unsubscribe needs correct callback URL --- app/services/block_domain_service.rb | 2 +- lib/tasks/mastodon.rake | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/services/block_domain_service.rb b/app/services/block_domain_service.rb index 075460605..ac658a050 100644 --- a/app/services/block_domain_service.rb +++ b/app/services/block_domain_service.rb @@ -4,7 +4,7 @@ class BlockDomainService < BaseService Account.where(domain: domain).find_each do |account| if account.subscribed? - account.subscription('').unsubscribe + account.subscription(api_subscription_url(account.id)).unsubscribe end account.destroy! diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index 872b33cdd..29e4494c4 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -11,11 +11,13 @@ namespace :mastodon do namespace :push do desc 'Unsubscribes from PuSH updates of feeds nobody follows locally' task clear: :environment do + include RoutingHelper + Account.remote.without_followers.find_each do |a| Rails.logger.debug "PuSH unsubscribing from #{a.acct}" begin - a.subscription('').unsubscribe + a.subscription(api_subscription_url(a.id)).unsubscribe rescue HTTP::Error, OpenSSL::SSL::SSLError Rails.logger.debug "PuSH unsubscribing from #{a.acct} failed due to an HTTP or SSL error" ensure