You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
410 B

  1. namespace :subscriptions do
  2. desc "For all remote accounts that have no local followers, unsubscribe from PuSH"
  3. task clear: :environment do
  4. accounts = Account.where('(select count(f.id) from follows as f where f.target_account_id = accounts.id) = 0').where.not(domain: nil)
  5. accounts.each do |a|
  6. a.subscription('').unsubscribe
  7. a.update!(verify_token: '', secret: '')
  8. end
  9. end
  10. end