about summary refs log tree commit diff
path: root/app/controllers/admin/followers_controller.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-01-02 20:03:32 +0100
committerGitHub <noreply@github.com>2019-01-02 20:03:32 +0100
commit0acd51acdc1e670bf57f58671cb8e30743782c63 (patch)
treef5ff0b5c3b1e8fd94691264f2bc147e5fa233ecb /app/controllers/admin/followers_controller.rb
parentb300948526d967aaf5608c93546ee0d54940c0ef (diff)
parente77ceb1b29547ed89b4110b3cc3edc9ac325b620 (diff)
Merge pull request #878 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers/admin/followers_controller.rb')
-rw-r--r--app/controllers/admin/followers_controller.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/controllers/admin/followers_controller.rb b/app/controllers/admin/followers_controller.rb
new file mode 100644
index 000000000..819628b20
--- /dev/null
+++ b/app/controllers/admin/followers_controller.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+module Admin
+  class FollowersController < BaseController
+    before_action :set_account
+
+    PER_PAGE = 40
+
+    def index
+      authorize :account, :index?
+      @followers = followers.recent.page(params[:page]).per(PER_PAGE)
+    end
+
+    def set_account
+      @account = Account.find(params[:account_id])
+    end
+
+    def followers
+      Follow.includes(:account).where(target_account: @account)
+    end
+  end
+end