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.

28 lines
731 B

  1. # frozen_string_literal: true
  2. class Settings::FollowerDomainsController < ApplicationController
  3. layout 'admin'
  4. before_action :authenticate_user!
  5. def show
  6. @account = current_account
  7. @domains = current_account.followers.reorder(nil).group('accounts.domain').select('accounts.domain, count(accounts.id) as accounts_from_domain').page(params[:page]).per(10)
  8. end
  9. def update
  10. domains = bulk_params[:select] || []
  11. domains.each do |domain|
  12. SoftBlockDomainFollowersWorker.perform_async(current_account.id, domain)
  13. end
  14. redirect_to settings_follower_domains_path, notice: I18n.t('followers.success', count: domains.size)
  15. end
  16. private
  17. def bulk_params
  18. params.permit(select: [])
  19. end
  20. end