logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

follower_domains_controller.rb (777B)


  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(Arel.sql('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