From 6893bccd06320c22162037047ab90fc90cfa0246 Mon Sep 17 00:00:00 2001
From: Yar <YarTheGreat@gmail.com>
Date: Wed, 26 Oct 2016 22:54:03 +0300
Subject: [PATCH] Rename :name search parameter to :search_query at
 /admin/users

The parameter is used to search users by several criretia was
called :name. This request renames it to :search_query which closer
to it actual perpose
---
 CHANGELOG.md                              | 1 +
 app/controllers/admin/users_controller.rb | 2 +-
 app/views/admin/users/index.html.haml     | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 372ddecc98bac..26f0a0eb1c1cc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -40,6 +40,7 @@ Please view this file on the master branch, on stable branches it's out of date.
 - Refactor email, use setter method instead AR callbacks for email attribute (Semyon Pupkov)
 - Shortened merge request modal to let clipboard button not overlap
 - In all filterable drop downs, put input field in focus only after load is complete (Ido @leibo)
+- Improve search query parameter naming in /admin/users !7115 (YarNayar)
 
 ## 8.13.2 (2016-10-31)
 
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index f35f4a8c81125..57efa8996949a 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -3,7 +3,7 @@ class Admin::UsersController < Admin::ApplicationController
 
   def index
     @users = User.order_name_asc.filter(params[:filter])
-    @users = @users.search(params[:name]) if params[:name].present?
+    @users = @users.search(params[:search_query]) if params[:search_query].present?
     @users = @users.sort(@sort = params[:sort])
     @users = @users.page(params[:page])
   end
diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml
index 357123c2c1344..d3038ae644f82 100644
--- a/app/views/admin/users/index.html.haml
+++ b/app/views/admin/users/index.html.haml
@@ -10,7 +10,7 @@
           = hidden_field_tag "filter", h(params[:filter])
         .search-holder
           .search-field-holder
-            = search_field_tag :name, params[:name], placeholder: 'Search by name, email or username', class: 'form-control search-text-input js-search-input', spellcheck: false
+            = search_field_tag :search_query, params[:search_query], placeholder: 'Search by name, email or username', class: 'form-control search-text-input js-search-input', spellcheck: false
             = icon("search", class: "search-icon")
           .dropdown
             - toggle_text = if @sort.present? then sort_options_hash[@sort] else sort_title_name end
-- 
GitLab