闭社主体 forked from https://github.com/tootsuite/mastodon
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.

15 lines
397 B

  1. # frozen_string_literal: true
  2. class Pubsubhubbub::UnsubscribeService < BaseService
  3. def call(account, callback)
  4. return ['Invalid topic URL', 422] if account.nil?
  5. subscription = Subscription.where(account: account, callback_url: callback)
  6. unless subscription.nil?
  7. Pubsubhubbub::ConfirmationWorker.perform_async(subscription.id, 'unsubscribe')
  8. end
  9. ['', 202]
  10. end
  11. end