about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-07-20 23:07:13 +0200
committerGitHub <noreply@github.com>2017-07-20 23:07:13 +0200
commit4b911fea03a204a1a1cc0e5f63ede1679e0494c3 (patch)
tree0edccd2b9e6268044b965af9c091695dc610978f /app
parent1fcdaafa6fbe6d746a096c33263d76e6819da46d (diff)
Add button to re-subscribe to all accounts from a domain (#4285)
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/instances_controller.rb11
-rw-r--r--app/views/admin/instances/_instance.html.haml2
2 files changed, 13 insertions, 0 deletions
diff --git a/app/controllers/admin/instances_controller.rb b/app/controllers/admin/instances_controller.rb
index ac93248a8..3296e08db 100644
--- a/app/controllers/admin/instances_controller.rb
+++ b/app/controllers/admin/instances_controller.rb
@@ -6,15 +6,26 @@ module Admin
       @instances = ordered_instances
     end
 
+    def resubscribe
+      params.require(:by_domain)
+      Pubsubhubbub::SubscribeWorker.push_bulk(subscribeable_accounts.pluck(:id))
+      redirect_to admin_instances_path
+    end
+
     private
 
     def paginated_instances
       Account.remote.by_domain_accounts.page(params[:page])
     end
+
     helper_method :paginated_instances
 
     def ordered_instances
       paginated_instances.map { |account| Instance.new(account) }
     end
+
+    def subscribeable_accounts
+      Account.with_followers.remote.where(domain: params[:by_domain])
+    end
   end
 end
diff --git a/app/views/admin/instances/_instance.html.haml b/app/views/admin/instances/_instance.html.haml
index 5c6783d06..435cd8f64 100644
--- a/app/views/admin/instances/_instance.html.haml
+++ b/app/views/admin/instances/_instance.html.haml
@@ -3,3 +3,5 @@
     = instance.domain
   %td.count
     = instance.accounts_count
+  %td
+    = table_link_to 'paper-plane-o', t('admin.accounts.resubscribe'), resubscribe_admin_instances_url(by_domain: instance.domain), method: :post, data: { confirm: t('admin.accounts.are_you_sure') }