summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-02-04 13:10:31 +0100
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-02-04 13:10:31 +0100
commit2d9d2e7a7cef552159f7ee9fa84198a1d52f317f (patch)
tree7dea71bce833c8cdd57fc3bce900b33c382329a1
parentb5befc734be55a4a7a07519baf03e0ba29c0f8c5 (diff)
parent70e44d63f7f1af81ddb0527e3a084c6ab692ea58 (diff)
downloadgitlab-ce-2d9d2e7a7cef552159f7ee9fa84198a1d52f317f.tar.gz
Merge branch 'better-search-autocomplete'
-rw-r--r--CHANGELOG1
-rw-r--r--app/helpers/search_helper.rb4
2 files changed, 3 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 6a8516fd406..f434e361281 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -29,6 +29,7 @@ v 8.5.0 (unreleased)
- Improve UI consistency between projects and groups lists
- Add sort dropdown to dashboard projects page
- Hide remove source branch button when the MR is merged but new commits are pushed (Zeger-Jan van de Weg)
+ - In seach autocomplete show only groups and projects you are member of
v 8.4.3
- Increase lfs_objects size column to 8-byte integer to allow files larger
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index d4f78258626..1eb790b1796 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -70,7 +70,7 @@ module SearchHelper
# Autocomplete results for the current user's groups
def groups_autocomplete(term, limit = 5)
- Group.search(term).limit(limit).map do |group|
+ current_user.authorized_groups.search(term).limit(limit).map do |group|
{
label: "group: #{search_result_sanitize(group.name)}",
url: group_path(group)
@@ -80,7 +80,7 @@ module SearchHelper
# Autocomplete results for the current user's projects
def projects_autocomplete(term, limit = 5)
- ProjectsFinder.new.execute(current_user).search_by_title(term).
+ current_user.authorized_projects.search_by_title(term).
sorted_by_stars.non_archived.limit(limit).map do |p|
{
label: "project: #{search_result_sanitize(p.name_with_namespace)}",