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.

24 lines
700 B

  1. # frozen_string_literal: true
  2. class Settings::FollowerDomainsController < Settings::BaseController
  3. def show
  4. @account = current_account
  5. @domains = current_account.followers.reorder(Arel.sql('MIN(follows.id) DESC')).group('accounts.domain').select('accounts.domain, count(accounts.id) as accounts_from_domain').page(params[:page]).per(10)
  6. end
  7. def update
  8. domains = bulk_params[:select] || []
  9. AfterAccountDomainBlockWorker.push_bulk(domains) do |domain|
  10. [current_account.id, domain]
  11. end
  12. redirect_to settings_follower_domains_path, notice: I18n.t('followers.success', count: domains.size)
  13. end
  14. private
  15. def bulk_params
  16. params.permit(select: [])
  17. end
  18. end