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
c18aab93
Commit
c18aab93
authored
Aug 20, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
30a85e86
57ec78d5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
5 deletions
+26
-5
changelogs/unreleased/sh-fix-issues-api-gitaly-nplusone.yml
changelogs/unreleased/sh-fix-issues-api-gitaly-nplusone.yml
+5
-0
doc/api/issues.md
doc/api/issues.md
+0
-2
lib/api/entities.rb
lib/api/entities.rb
+4
-1
lib/api/issues.rb
lib/api/issues.rb
+4
-2
spec/requests/api/issues/get_group_issues_spec.rb
spec/requests/api/issues/get_group_issues_spec.rb
+8
-0
spec/requests/api/issues/get_project_issues_spec.rb
spec/requests/api/issues/get_project_issues_spec.rb
+1
-0
spec/requests/api/issues/issues_spec.rb
spec/requests/api/issues/issues_spec.rb
+4
-0
No files found.
changelogs/unreleased/sh-fix-issues-api-gitaly-nplusone.yml
0 → 100644
View file @
c18aab93
---
title
:
Fix Gitaly N+1 calls with listing issues/MRs via API
merge_request
:
31938
author
:
type
:
performance
doc/api/issues.md
View file @
c18aab93
...
...
@@ -136,7 +136,6 @@ Example response:
"award_emoji"
:
"http://example.com/api/v4/projects/1/issues/76/award_emoji"
,
"project"
:
"http://example.com/api/v4/projects/1"
},
"subscribed"
:
false
,
"task_completion_status"
:{
"count"
:
0
,
"completed_count"
:
0
...
...
@@ -441,7 +440,6 @@ Example response:
"award_emoji"
:
"http://example.com/api/v4/projects/4/issues/41/award_emoji"
,
"project"
:
"http://example.com/api/v4/projects/4"
},
"subscribed"
:
false
,
"task_completion_status"
:{
"count"
:
0
,
"completed_count"
:
0
...
...
lib/api/entities.rb
View file @
c18aab93
...
...
@@ -645,7 +645,10 @@ module API
end
end
expose
:subscribed
do
|
issue
,
options
|
# Calculating the value of subscribed field triggers Markdown
# processing. We can't do that for multiple issues / merge
# requests in a single API request.
expose
:subscribed
,
if:
->
(
_
,
options
)
{
options
.
fetch
(
:include_subscribed
,
true
)
}
do
|
issue
,
options
|
issue
.
subscribed?
(
options
[
:current_user
],
options
[
:project
]
||
issue
.
project
)
end
end
...
...
lib/api/issues.rb
View file @
c18aab93
...
...
@@ -96,7 +96,8 @@ module API
with:
Entities
::
Issue
,
with_labels_details:
declared_params
[
:with_labels_details
],
current_user:
current_user
,
issuable_metadata:
issuable_meta_data
(
issues
,
'Issue'
,
current_user
)
issuable_metadata:
issuable_meta_data
(
issues
,
'Issue'
,
current_user
),
include_subscribed:
false
}
present
issues
,
options
...
...
@@ -122,7 +123,8 @@ module API
with:
Entities
::
Issue
,
with_labels_details:
declared_params
[
:with_labels_details
],
current_user:
current_user
,
issuable_metadata:
issuable_meta_data
(
issues
,
'Issue'
,
current_user
)
issuable_metadata:
issuable_meta_data
(
issues
,
'Issue'
,
current_user
),
include_subscribed:
false
}
present
issues
,
options
...
...
spec/requests/api/issues/get_group_issues_spec.rb
View file @
c18aab93
...
...
@@ -342,6 +342,14 @@ describe API::Issues do
group_project
.
add_reporter
(
user
)
end
it
'exposes known attributes'
do
get
api
(
base_url
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
.
last
.
keys
).
to
include
(
*
%w(id iid project_id title description)
)
expect
(
json_response
.
last
).
not_to
have_key
(
'subscribed'
)
end
it
'returns all group issues (including opened and closed)'
do
get
api
(
base_url
,
admin
)
...
...
spec/requests/api/issues/get_project_issues_spec.rb
View file @
c18aab93
...
...
@@ -575,6 +575,7 @@ describe API::Issues do
expect
(
json_response
[
'assignee'
]).
to
be_a
Hash
expect
(
json_response
[
'author'
]).
to
be_a
Hash
expect
(
json_response
[
'confidential'
]).
to
be_falsy
expect
(
json_response
[
'subscribed'
]).
to
be_truthy
end
it
'exposes the closed_at attribute'
do
...
...
spec/requests/api/issues/issues_spec.rb
View file @
c18aab93
...
...
@@ -216,6 +216,10 @@ describe API::Issues do
expect_paginated_array_response
([
issue
.
id
,
closed_issue
.
id
])
expect
(
json_response
.
first
[
'title'
]).
to
eq
(
issue
.
title
)
expect
(
json_response
.
last
).
to
have_key
(
'web_url'
)
# Calculating the value of subscribed field triggers Markdown
# processing. We can't do that for multiple issues / merge
# requests in a single API request.
expect
(
json_response
.
last
).
not_to
have_key
(
'subscribed'
)
end
it
'returns an array of closed issues'
do
...
...
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