Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
0fa5260f
Commit
0fa5260f
authored
Oct 16, 2018
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow search results to accept project_id
This gives flexiblity to avoid duplicated query of Project.
parent
623b7f30
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
lib/gitlab/search_results.rb
lib/gitlab/search_results.rb
+6
-1
No files found.
lib/gitlab/search_results.rb
View file @
0fa5260f
...
...
@@ -18,6 +18,11 @@ module Gitlab
@data
=
encode_utf8
(
opts
.
fetch
(
:data
,
nil
))
@per_page
=
opts
.
fetch
(
:per_page
,
20
)
@project
=
opts
.
fetch
(
:project
,
nil
)
# Some caller does not have project object (e.g. elastic search),
# yet they can trigger many calls in one go,
# causing duplicated queries.
# Allow those to just pass project_id instead.
@project_id
=
opts
.
fetch
(
:project_id
,
nil
)
end
def
path
...
...
@@ -25,7 +30,7 @@ module Gitlab
end
def
project_id
@project
&
.
id
@project
_id
||
@project
&
.
id
end
def
present
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment