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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
fafae771
Commit
fafae771
authored
Mar 27, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
e2d3f8eb
0610bb09
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
28 additions
and
12 deletions
+28
-12
app/assets/javascripts/diffs/components/diff_file_header.vue
app/assets/javascripts/diffs/components/diff_file_header.vue
+1
-4
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+0
-4
app/serializers/diff_file_entity.rb
app/serializers/diff_file_entity.rb
+1
-1
changelogs/unreleased/59296-add-filter-by-title-milestones-api.yml
...s/unreleased/59296-add-filter-by-title-milestones-api.yml
+5
-0
doc/api/group_milestones.md
doc/api/group_milestones.md
+2
-0
doc/api/milestones.md
doc/api/milestones.md
+2
-0
lib/api/helpers.rb
lib/api/helpers.rb
+6
-0
lib/api/milestone_responses.rb
lib/api/milestone_responses.rb
+2
-0
spec/javascripts/diffs/components/diff_file_header_spec.js
spec/javascripts/diffs/components/diff_file_header_spec.js
+0
-3
spec/support/api/milestones_shared_examples.rb
spec/support/api/milestones_shared_examples.rb
+9
-0
No files found.
app/assets/javascripts/diffs/components/diff_file_header.vue
View file @
fafae771
...
...
@@ -128,9 +128,6 @@ export default {
isModeChanged
()
{
return
this
.
diffFile
.
viewer
.
name
===
diffViewerModes
.
mode_changed
;
},
showExpandDiffToFullFileEnabled
()
{
return
gon
.
features
.
expandDiffFullFile
&&
!
this
.
diffFile
.
is_fully_expanded
;
},
},
mounted
()
{
polyfillSticky
(
this
.
$refs
.
header
);
...
...
@@ -258,7 +255,7 @@ export default {
<icon
name=
"external-link"
/>
</gl-button>
<gl-button
v-if=
"
showExpandDiffToFullFileEnabl
ed"
v-if=
"
!diffFile.is_fully_expand
ed"
class=
"expand-file js-expand-file"
@
click=
"toggleFullDiff(diffFile.file_path)"
>
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
fafae771
...
...
@@ -16,10 +16,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
before_action
:authenticate_user!
,
only:
[
:assign_related_issues
]
before_action
:check_user_can_push_to_source_branch!
,
only:
[
:rebase
]
before_action
only:
[
:show
]
do
push_frontend_feature_flag
(
:expand_diff_full_file
)
end
def
index
@merge_requests
=
@issuables
...
...
app/serializers/diff_file_entity.rb
View file @
fafae771
...
...
@@ -57,7 +57,7 @@ class DiffFileEntity < DiffFileBaseEntity
diff_file
.
diff_lines_for_serializer
end
expose
:is_fully_expanded
,
if:
->
(
diff_file
,
_
)
{
Feature
.
enabled?
(
:expand_diff_full_file
,
default_enabled:
true
)
&&
diff_file
.
text?
}
do
|
diff_file
|
expose
:is_fully_expanded
,
if:
->
(
diff_file
,
_
)
{
diff_file
.
text?
}
do
|
diff_file
|
diff_file
.
fully_expanded?
end
...
...
changelogs/unreleased/59296-add-filter-by-title-milestones-api.yml
0 → 100644
View file @
fafae771
---
title
:
Add select by title to milestones API
merge_request
:
26573
author
:
type
:
added
doc/api/group_milestones.md
View file @
fafae771
...
...
@@ -12,6 +12,7 @@ GET /groups/:id/milestones?iids[]=42
GET /groups/:id/milestones?iids[]=42&iids[]=43
GET /groups/:id/milestones?state=active
GET /groups/:id/milestones?state=closed
GET /groups/:id/milestones?title=1.0
GET /groups/:id/milestones?search=version
```
...
...
@@ -22,6 +23,7 @@ Parameters:
|
`id`
| integer/string | yes | The ID or
[
URL-encoded path of the group
](
README.md#namespaced-path-encoding
)
owned by the authenticated user |
|
`iids[]`
| Array[integer] | optional | Return only the milestones having the given
`iid`
|
|
`state`
| string | optional | Return only
`active`
or
`closed`
milestones |
|
`title`
| string | optional | Return only the milestones having the given
`title`
|
|
`search`
| string | optional | Return only milestones with a title or description matching the provided string |
```
bash
...
...
doc/api/milestones.md
View file @
fafae771
...
...
@@ -10,6 +10,7 @@ GET /projects/:id/milestones?iids[]=42
GET /projects/:id/milestones?iids[]=42&iids[]=43
GET /projects/:id/milestones?state=active
GET /projects/:id/milestones?state=closed
GET /projects/:id/milestones?title=1.0
GET /projects/:id/milestones?search=version
```
...
...
@@ -20,6 +21,7 @@ Parameters:
|
`id`
| integer/string | yes | The ID or
[
URL-encoded path of the project
](
README.md#namespaced-path-encoding
)
owned by the authenticated user |
|
`iids[]`
| Array[integer] | optional | Return only the milestones having the given
`iid`
|
|
`state`
| string | optional | Return only
`active`
or
`closed`
milestones |
|
`title`
| string | optional | Return only the milestones having the given
`title`
|
|
`search`
| string | optional | Return only milestones with a title or description matching the provided string |
```
bash
...
...
lib/api/helpers.rb
View file @
fafae771
...
...
@@ -302,6 +302,12 @@ module API
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
filter_by_title
(
items
,
title
)
items
.
where
(
title:
title
)
end
# rubocop: enable CodeReuse/ActiveRecord
def
filter_by_search
(
items
,
text
)
items
.
search
(
text
)
end
...
...
lib/api/milestone_responses.rb
View file @
fafae771
...
...
@@ -16,6 +16,7 @@ module API
optional
:state
,
type:
String
,
values:
%w[active closed all]
,
default:
'all'
,
desc:
'Return "active", "closed", or "all" milestones'
optional
:iids
,
type:
Array
[
Integer
],
desc:
'The IIDs of the milestones'
optional
:title
,
type:
String
,
desc:
'The title of the milestones'
optional
:search
,
type:
String
,
desc:
'The search criteria for the title or description of the milestone'
use
:pagination
end
...
...
@@ -33,6 +34,7 @@ module API
milestones
=
parent
.
milestones
.
order_id_desc
milestones
=
Milestone
.
filter_by_state
(
milestones
,
params
[
:state
])
milestones
=
filter_by_iid
(
milestones
,
params
[
:iids
])
if
params
[
:iids
].
present?
milestones
=
filter_by_title
(
milestones
,
params
[
:title
])
if
params
[
:title
]
milestones
=
filter_by_search
(
milestones
,
params
[
:search
])
if
params
[
:search
]
present
paginate
(
milestones
),
with:
Entities
::
Milestone
...
...
spec/javascripts/diffs/components/diff_file_header_spec.js
View file @
fafae771
...
...
@@ -23,9 +23,6 @@ describe('diff_file_header', () => {
});
beforeEach
(()
=>
{
gon
.
features
=
{
expandDiffFullFile
:
true
,
};
const
diffFile
=
diffDiscussionMock
.
diff_file
;
diffFile
.
added_lines
=
2
;
...
...
spec/support/api/milestones_shared_examples.rb
View file @
fafae771
...
...
@@ -72,6 +72,15 @@ shared_examples_for 'group and project milestones' do |route_definition|
expect
(
json_response
.
first
[
'id'
]).
to
eq
closed_milestone
.
id
end
it
'returns a milestone by title'
do
get
api
(
route
,
user
),
params:
{
title:
'version2'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'title'
]).
to
eq
milestone
.
title
expect
(
json_response
.
first
[
'id'
]).
to
eq
milestone
.
id
end
it
'returns a milestone by searching for title'
do
get
api
(
route
,
user
),
params:
{
search:
'version2'
}
...
...
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