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:
authorJarka Kadlecová <jarka@gitlab.com>2018-01-31 17:59:59 +0300
committerJarka Kadlecová <jarka@gitlab.com>2018-02-06 18:02:02 +0300
commit7381944565701f2a8db5d58d5bc3c7e52e7f60bf (patch)
treea9bb7687b3809082555bd78dd5e1c5696d768910 /lib/gitlab/search_results.rb
parent0e15a5b805e832c22c67cead8c4829e6c77cd498 (diff)
Support search in API
Diffstat (limited to 'lib/gitlab/search_results.rb')
-rw-r--r--lib/gitlab/search_results.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/gitlab/search_results.rb b/lib/gitlab/search_results.rb
index 7362514167f..5ad219179f3 100644
--- a/lib/gitlab/search_results.rb
+++ b/lib/gitlab/search_results.rb
@@ -10,6 +10,7 @@ module Gitlab
@ref = opts.fetch(:ref, nil)
@startline = opts.fetch(:startline, nil)
@data = opts.fetch(:data, nil)
+ @per_page = opts.fetch(:per_page, 20)
end
def path
@@ -21,7 +22,7 @@ module Gitlab
end
end
- attr_reader :current_user, :query
+ attr_reader :current_user, :query, :per_page
# Limit search results by passed projects
# It allows us to search only for projects user has access to
@@ -33,11 +34,12 @@ module Gitlab
# query
attr_reader :default_project_filter
- def initialize(current_user, limit_projects, query, default_project_filter: false)
+ def initialize(current_user, limit_projects, query, default_project_filter: false, per_page: 20)
@current_user = current_user
@limit_projects = limit_projects || Project.all
@query = query
@default_project_filter = default_project_filter
+ @per_page = per_page
end
def objects(scope, page = nil, without_count = true)
@@ -153,10 +155,6 @@ module Gitlab
'projects'
end
- def per_page
- 20
- end
-
def project_ids_relation
limit_projects.select(:id).reorder(nil)
end