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
9b0f8a77
Commit
9b0f8a77
authored
Feb 19, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
cf21118f
08e2104e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
1 deletion
+44
-1
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+2
-1
changelogs/unreleased/add-related-merge-request-count-to-api-response.yml
...eased/add-related-merge-request-count-to-api-response.yml
+5
-0
doc/api/issues.md
doc/api/issues.md
+10
-0
lib/api/entities.rb
lib/api/entities.rb
+9
-0
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+18
-0
No files found.
app/assets/javascripts/main.js
View file @
9b0f8a77
...
@@ -81,7 +81,6 @@ function deferredInitialisation() {
...
@@ -81,7 +81,6 @@ function deferredInitialisation() {
initUserPopovers
();
initUserPopovers
();
if
(
document
.
querySelector
(
'
.search
'
))
initSearchAutocomplete
();
if
(
document
.
querySelector
(
'
.search
'
))
initSearchAutocomplete
();
if
(
document
.
querySelector
(
'
#js-peek
'
))
initPerformanceBar
({
container
:
'
#js-peek
'
});
addSelectOnFocusBehaviour
(
'
.js-select-on-focus
'
);
addSelectOnFocusBehaviour
(
'
.js-select-on-focus
'
);
...
@@ -148,6 +147,8 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -148,6 +147,8 @@ document.addEventListener('DOMContentLoaded', () => {
const
$sidebarGutterToggle
=
$
(
'
.js-sidebar-toggle
'
);
const
$sidebarGutterToggle
=
$
(
'
.js-sidebar-toggle
'
);
let
bootstrapBreakpoint
=
bp
.
getBreakpointSize
();
let
bootstrapBreakpoint
=
bp
.
getBreakpointSize
();
if
(
document
.
querySelector
(
'
#js-peek
'
))
initPerformanceBar
({
container
:
'
#js-peek
'
});
initLayoutNav
();
initLayoutNav
();
// Set the default path for all cookies to GitLab's root directory
// Set the default path for all cookies to GitLab's root directory
...
...
changelogs/unreleased/add-related-merge-request-count-to-api-response.yml
0 → 100644
View file @
9b0f8a77
---
title
:
Add related merge request count to api response
merge_request
:
24974
author
:
type
:
added
doc/api/issues.md
View file @
9b0f8a77
...
@@ -111,6 +111,7 @@ Example response:
...
@@ -111,6 +111,7 @@ Example response:
"labels"
:
[],
"labels"
:
[],
"upvotes"
:
4
,
"upvotes"
:
4
,
"downvotes"
:
0
,
"downvotes"
:
0
,
"merge_requests_count"
:
0
,
"user_notes_count"
:
1
,
"user_notes_count"
:
1
,
"due_date"
:
"2016-07-22"
,
"due_date"
:
"2016-07-22"
,
"web_url"
:
"http://example.com/example/example/issues/6"
,
"web_url"
:
"http://example.com/example/example/issues/6"
,
...
@@ -222,6 +223,7 @@ Example response:
...
@@ -222,6 +223,7 @@ Example response:
"labels"
:
[],
"labels"
:
[],
"upvotes"
:
4
,
"upvotes"
:
4
,
"downvotes"
:
0
,
"downvotes"
:
0
,
"merge_requests_count"
:
0
,
"id"
:
41
,
"id"
:
41
,
"title"
:
"Ut commodi ullam eos dolores perferendis nihil sunt."
,
"title"
:
"Ut commodi ullam eos dolores perferendis nihil sunt."
,
"updated_at"
:
"2016-01-04T15:31:46.176Z"
,
"updated_at"
:
"2016-01-04T15:31:46.176Z"
,
...
@@ -339,6 +341,7 @@ Example response:
...
@@ -339,6 +341,7 @@ Example response:
"labels"
:
[],
"labels"
:
[],
"upvotes"
:
4
,
"upvotes"
:
4
,
"downvotes"
:
0
,
"downvotes"
:
0
,
"merge_requests_count"
:
0
,
"id"
:
41
,
"id"
:
41
,
"title"
:
"Ut commodi ullam eos dolores perferendis nihil sunt."
,
"title"
:
"Ut commodi ullam eos dolores perferendis nihil sunt."
,
"updated_at"
:
"2016-01-04T15:31:46.176Z"
,
"updated_at"
:
"2016-01-04T15:31:46.176Z"
,
...
@@ -436,6 +439,7 @@ Example response:
...
@@ -436,6 +439,7 @@ Example response:
"labels"
:
[],
"labels"
:
[],
"upvotes"
:
4
,
"upvotes"
:
4
,
"downvotes"
:
0
,
"downvotes"
:
0
,
"merge_requests_count"
:
0
,
"id"
:
41
,
"id"
:
41
,
"title"
:
"Ut commodi ullam eos dolores perferendis nihil sunt."
,
"title"
:
"Ut commodi ullam eos dolores perferendis nihil sunt."
,
"updated_at"
:
"2016-01-04T15:31:46.176Z"
,
"updated_at"
:
"2016-01-04T15:31:46.176Z"
,
...
@@ -513,6 +517,7 @@ Example response:
...
@@ -513,6 +517,7 @@ Example response:
],
],
"upvotes"
:
4
,
"upvotes"
:
4
,
"downvotes"
:
0
,
"downvotes"
:
0
,
"merge_requests_count"
:
0
,
"author"
:
{
"author"
:
{
"name"
:
"Alexandra Bashirian"
,
"name"
:
"Alexandra Bashirian"
,
"avatar_url"
:
null
,
"avatar_url"
:
null
,
...
@@ -614,6 +619,7 @@ Example response:
...
@@ -614,6 +619,7 @@ Example response:
],
],
"upvotes"
:
4
,
"upvotes"
:
4
,
"downvotes"
:
0
,
"downvotes"
:
0
,
"merge_requests_count"
:
0
,
"id"
:
85
,
"id"
:
85
,
"assignees"
:
[],
"assignees"
:
[],
"assignee"
:
null
,
"assignee"
:
null
,
...
@@ -701,6 +707,7 @@ Example response:
...
@@ -701,6 +707,7 @@ Example response:
"labels"
:
[],
"labels"
:
[],
"upvotes"
:
4
,
"upvotes"
:
4
,
"downvotes"
:
0
,
"downvotes"
:
0
,
"merge_requests_count"
:
0
,
"milestone"
:
null
,
"milestone"
:
null
,
"assignees"
:
[{
"assignees"
:
[{
"name"
:
"Miss Monserrate Beier"
,
"name"
:
"Miss Monserrate Beier"
,
...
@@ -786,6 +793,7 @@ Example response:
...
@@ -786,6 +793,7 @@ Example response:
"labels"
:
[],
"labels"
:
[],
"upvotes"
:
4
,
"upvotes"
:
4
,
"downvotes"
:
0
,
"downvotes"
:
0
,
"merge_requests_count"
:
0
,
"milestone"
:
null
,
"milestone"
:
null
,
"assignees"
:
[{
"assignees"
:
[{
"name"
:
"Miss Monserrate Beier"
,
"name"
:
"Miss Monserrate Beier"
,
...
@@ -869,6 +877,7 @@ Example response:
...
@@ -869,6 +877,7 @@ Example response:
"labels"
:
[],
"labels"
:
[],
"upvotes"
:
4
,
"upvotes"
:
4
,
"downvotes"
:
0
,
"downvotes"
:
0
,
"merge_requests_count"
:
0
,
"milestone"
:
null
,
"milestone"
:
null
,
"assignee"
:
{
"assignee"
:
{
"name"
:
"Edwardo Grady"
,
"name"
:
"Edwardo Grady"
,
...
@@ -986,6 +995,7 @@ Example response:
...
@@ -986,6 +995,7 @@ Example response:
"user_notes_count"
:
7
,
"user_notes_count"
:
7
,
"upvotes"
:
0
,
"upvotes"
:
0
,
"downvotes"
:
0
,
"downvotes"
:
0
,
"merge_requests_count"
:
0
,
"due_date"
:
null
,
"due_date"
:
null
,
"web_url"
:
"http://example.com/example/example/issues/110"
,
"web_url"
:
"http://example.com/example/example/issues/110"
,
"confidential"
:
false
,
"confidential"
:
false
,
...
...
lib/api/entities.rb
View file @
9b0f8a77
...
@@ -559,6 +559,15 @@ module API
...
@@ -559,6 +559,15 @@ module API
expose
:time_stats
,
using:
'API::Entities::IssuableTimeStats'
do
|
issue
|
expose
:time_stats
,
using:
'API::Entities::IssuableTimeStats'
do
|
issue
|
issue
issue
end
end
expose
:merge_requests_count
do
|
issue
,
options
|
if
options
[
:issuable_metadata
]
# Avoids an N+1 query when metadata is included
options
[
:issuable_metadata
][
issue
.
id
].
merge_requests_count
else
issue
.
merge_requests_closing_issues
.
count
end
end
end
end
class
Issue
<
IssueBasic
class
Issue
<
IssueBasic
...
...
spec/requests/api/issues_spec.rb
View file @
9b0f8a77
...
@@ -425,6 +425,24 @@ describe API::Issues do
...
@@ -425,6 +425,24 @@ describe API::Issues do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/issues'
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/issues'
)
end
end
it
'returns a related merge request count of 0 if there are no related merge requests'
do
get
api
(
'/issues'
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/issues'
)
expect
(
json_response
.
first
).
to
include
(
'merge_requests_count'
=>
0
)
end
it
'returns a related merge request count > 0 if there are related merge requests'
do
create
(
:merge_requests_closing_issues
,
issue:
issue
)
get
api
(
'/issues'
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/issues'
)
expect
(
json_response
.
first
).
to
include
(
'merge_requests_count'
=>
1
)
end
end
end
end
end
...
...
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