summaryrefslogtreecommitdiff
path: root/app/helpers/search_helper.rb
diff options
context:
space:
mode:
authorJason Hollingsworth <jhworth.developer@gmail.com>2014-02-13 14:45:51 -0600
committerJason Hollingsworth <jhworth.developer@gmail.com>2014-02-20 09:26:38 -0600
commit2f69213e3f32e2e4222f6335e790e2c778069014 (patch)
tree3734a9d41d2445a1557ed2f79c6cfa3de7dec215 /app/helpers/search_helper.rb
parent138e2a50b7d839bd37c21b2849df422f9dfef6bb (diff)
downloadgitlab-ce-2f69213e3f32e2e4222f6335e790e2c778069014.tar.gz
Allow access to groups with public projects.
Fixed Group avatars to only display when user has read permissions to at least one project in the group.
Diffstat (limited to 'app/helpers/search_helper.rb')
-rw-r--r--app/helpers/search_helper.rb15
1 files changed, 2 insertions, 13 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index 470a495f036..d7f3da7e537 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -4,8 +4,7 @@ module SearchHelper
resources_results = [
groups_autocomplete(term),
- projects_autocomplete(term),
- public_projects_autocomplete(term),
+ projects_autocomplete(term)
].flatten
generic_results = project_autocomplete + default_autocomplete + help_autocomplete
@@ -82,17 +81,7 @@ module SearchHelper
# Autocomplete results for the current user's projects
def projects_autocomplete(term, limit = 5)
- current_user.authorized_projects.search_by_title(term).non_archived.limit(limit).map do |p|
- {
- label: "project: #{search_result_sanitize(p.name_with_namespace)}",
- url: project_path(p)
- }
- end
- end
-
- # Autocomplete results for the current user's projects
- def public_projects_autocomplete(term, limit = 5)
- Project.public_or_internal_only(current_user).search_by_title(term).non_archived.limit(limit).map do |p|
+ Project.accessible_to(current_user).search_by_title(term).non_archived.limit(limit).map do |p|
{
label: "project: #{search_result_sanitize(p.name_with_namespace)}",
url: project_path(p)