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.

26 lines
670 B

  1. # frozen_string_literal: true
  2. class AfterBlockService < BaseService
  3. def call(account, target_account)
  4. @account = account
  5. @target_account = target_account
  6. clear_home_feed!
  7. clear_notifications!
  8. clear_conversations!
  9. end
  10. private
  11. def clear_home_feed!
  12. FeedManager.instance.clear_from_timeline(@account, @target_account)
  13. end
  14. def clear_conversations!
  15. AccountConversation.where(account: @account).where('? = ANY(participant_account_ids)', @target_account.id).in_batches.destroy_all
  16. end
  17. def clear_notifications!
  18. Notification.where(account: @account).where(from_account: @target_account).in_batches.delete_all
  19. end
  20. end