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.

30 lines
767 B

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