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
Boxiang Sun
gitlab-ce
Commits
68ff219c
Commit
68ff219c
authored
Feb 09, 2018
by
Jarka Kadlecová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API - fix searching in group/project specified by path
parent
fa0923dd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
lib/api/search.rb
lib/api/search.rb
+4
-4
spec/requests/api/search_spec.rb
spec/requests/api/search_spec.rb
+20
-0
No files found.
lib/api/search.rb
View file @
68ff219c
...
...
@@ -85,9 +85,9 @@ module API
use
:pagination
end
get
':id/-/search'
do
find_group!
(
params
[
:id
])
group
=
find_group!
(
params
[
:id
])
present
search
(
group_id:
params
[
:id
]
),
with:
entity
present
search
(
group_id:
group
.
id
),
with:
entity
end
end
...
...
@@ -106,9 +106,9 @@ module API
use
:pagination
end
get
':id/-/search'
do
find_project!
(
params
[
:id
])
project
=
find_project!
(
params
[
:id
])
present
search
(
project_id:
p
arams
[
:id
]
),
with:
entity
present
search
(
project_id:
p
roject
.
id
),
with:
entity
end
end
end
...
...
spec/requests/api/search_spec.rb
View file @
68ff219c
...
...
@@ -180,6 +180,18 @@ describe API::Search do
it_behaves_like
'response is correct'
,
schema:
'public_api/v4/milestones'
end
context
'for milestones scope with group path as id'
do
before
do
another_project
=
create
(
:project
,
:public
)
create
(
:milestone
,
project:
project
,
title:
'awesome milestone'
)
create
(
:milestone
,
project:
another_project
,
title:
'awesome milestone other project'
)
get
api
(
"/groups/
#{
CGI
.
escape
(
group
.
full_path
)
}
/-/search"
,
user
),
scope:
'milestones'
,
search:
'awesome'
end
it_behaves_like
'response is correct'
,
schema:
'public_api/v4/milestones'
end
end
end
...
...
@@ -286,6 +298,14 @@ describe API::Search do
it_behaves_like
'response is correct'
,
schema:
'public_api/v4/commits'
end
context
'for commits scope with project path as id'
do
before
do
get
api
(
"/projects/
#{
CGI
.
escape
(
repo_project
.
full_path
)
}
/-/search"
,
user
),
scope:
'commits'
,
search:
'498214de67004b1da3d820901307bed2a68a8ef6'
end
it_behaves_like
'response is correct'
,
schema:
'public_api/v4/commits'
end
context
'for blobs scope'
do
before
do
get
api
(
"/projects/
#{
repo_project
.
id
}
/-/search"
,
user
),
scope:
'blobs'
,
search:
'monitors'
...
...
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