about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2017-12-02 00:40:02 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-12-01 16:40:02 +0100
commit74320971e2cc9f605dbcc23c52ac36e18b80716f (patch)
tree444edcce8371270e8f4a632a4423fc589ec9aa7a /app/controllers
parenteee3b32b7714a302ae384c92ef13601167ec892a (diff)
Add invite filter (#5862)
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin/invites_controller.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/admin/invites_controller.rb b/app/controllers/admin/invites_controller.rb
index 607588d90..faccaa7c8 100644
--- a/app/controllers/admin/invites_controller.rb
+++ b/app/controllers/admin/invites_controller.rb
@@ -5,7 +5,7 @@ module Admin
     def index
       authorize :invite, :index?
 
-      @invites = Invite.includes(user: :account).page(params[:page])
+      @invites = filtered_invites.includes(user: :account).page(params[:page])
       @invite  = Invite.new
     end
 
@@ -35,5 +35,13 @@ module Admin
     def resource_params
       params.require(:invite).permit(:max_uses, :expires_in)
     end
+
+    def filtered_invites
+      InviteFilter.new(filter_params).results
+    end
+
+    def filter_params
+      params.permit(:available, :expired)
+    end
   end
 end