about summary refs log tree commit diff
path: root/app/controllers/settings
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/settings')
-rw-r--r--app/controllers/settings/follower_domains_controller.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/controllers/settings/follower_domains_controller.rb b/app/controllers/settings/follower_domains_controller.rb
new file mode 100644
index 000000000..13722345f
--- /dev/null
+++ b/app/controllers/settings/follower_domains_controller.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class Settings::FollowerDomainsController < ApplicationController
+  layout 'admin'
+
+  before_action :authenticate_user!
+
+  def show
+    @account = current_account
+    @domains = current_account.followers.reorder(nil).group('accounts.domain').select('accounts.domain, count(accounts.id) as accounts_from_domain').page(params[:page]).per(10)
+  end
+
+  def update
+    domains = bulk_params[:select] || []
+
+    domains.each do |domain|
+      SoftBlockDomainFollowersWorker.perform_async(current_account.id, domain)
+    end
+
+    redirect_to settings_follower_domains_path, notice: I18n.t('followers.success', count: domains.size)
+  end
+
+  private
+
+  def bulk_params
+    params.permit(select: [])
+  end
+end