The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

29 lines
755 B

  1. # frozen_string_literal: true
  2. class Settings::FollowerDomainsController < Settings::BaseController
  3. layout 'admin'
  4. before_action :authenticate_user!
  5. def show
  6. @account = current_account
  7. @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)
  8. end
  9. def update
  10. domains = bulk_params[:select] || []
  11. AfterAccountDomainBlockWorker.push_bulk(domains) do |domain|
  12. [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