From 33e22cf598c5a70f31926ca1f301bffcae59f1e8 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 3 Aug 2017 00:24:23 +0900 Subject: [PATCH] Add back `Admin::GroupsController#index` route for now. * The endpoint is being used by discourse_api. --- app/controllers/admin/groups_controller.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 1ad9367aa8e..dd99b2fda03 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -1,4 +1,18 @@ class Admin::GroupsController < Admin::AdminController + def index + groups = Group.order(:name).where("groups.id <> ?", Group::AUTO_GROUPS[:everyone]) + + if search = params[:search].to_s + groups = groups.where("name ILIKE ?", "%#{search}%") + end + + if params[:ignore_automatic].to_s == "true" + groups = groups.where(automatic: false) + end + + render_serialized(groups, BasicGroupSerializer) + end + def show render nothing: true end