Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/search_controller.rb')
-rw-r--r--app/controllers/search_controller.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index 820b00a902e..45c1c35a655 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -49,6 +49,12 @@ class SearchController < ApplicationController
scope = search_service.scope
count = search_service.search_results.formatted_count(scope)
+ # Users switching tabs will keep fetching the same tab counts so it's a
+ # good idea to cache in their browser just for a short time. They can still
+ # clear cache if they are seeing an incorrect count but inaccurate count is
+ # not such a bad thing.
+ expires_in 1.minute
+
render json: { count: count }
end
@@ -125,7 +131,7 @@ class SearchController < ApplicationController
payload[:metadata] ||= {}
payload[:metadata]['meta.search.group_id'] = params[:group_id]
payload[:metadata]['meta.search.project_id'] = params[:project_id]
- payload[:metadata]['meta.search.scope'] = params[:scope]
+ payload[:metadata]['meta.search.scope'] = params[:scope] || @scope
payload[:metadata]['meta.search.filters.confidential'] = params[:confidential]
payload[:metadata]['meta.search.filters.state'] = params[:state]
payload[:metadata]['meta.search.force_search_results'] = params[:force_search_results]