summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb1
-rw-r--r--app/services/search/global_service.rb3
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index cd35601d76b..80efb8ac792 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -224,6 +224,7 @@ class Project < ActiveRecord::Base
scope :with_project_feature, -> { joins('LEFT JOIN project_features ON projects.id = project_features.project_id') }
scope :with_statistics, -> { includes(:statistics) }
+ scope :inside_path, ->(path) { joins(:route).where('routes.path LIKE ?', "#{path}/%") }
# "enabled" here means "not disabled". It includes private features!
scope :with_feature_enabled, ->(feature) {
diff --git a/app/services/search/global_service.rb b/app/services/search/global_service.rb
index d477a5d3c7e..781cd13b44b 100644
--- a/app/services/search/global_service.rb
+++ b/app/services/search/global_service.rb
@@ -11,8 +11,7 @@ module Search
projects = ProjectsFinder.new.execute(current_user)
if group
- ids = group.descendants.push(group.id)
- projects = projects.in_namespace(ids)
+ projects = projects.inside_path(group.full_path)
end
Gitlab::SearchResults.new(current_user, projects, params[:search])