Skip to content

Commit

Permalink
Merge branch 'sh-fix-nplusone-issues' into 'master'
Browse files Browse the repository at this point in the history
Fix N+1 Gitaly calls in /api/v4/projects/:id/issues

See merge request gitlab-org/gitlab-ce!32171
  • Loading branch information
Mayra Cabrera committed Aug 26, 2019
2 parents a7f9a84 + 4406350 commit bbd3902
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changelogs/unreleased/sh-fix-nplusone-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Fix N+1 Gitaly calls in /api/v4/projects/:id/issues
merge_request: 32171
author:
type: performance
1 change: 0 additions & 1 deletion doc/api/issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,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
Expand Down
3 changes: 2 additions & 1 deletion lib/api/issues.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ class Issues < Grape::API
with_labels_details: declared_params[:with_labels_details],
current_user: current_user,
project: user_project,
issuable_metadata: issuable_meta_data(issues, 'Issue', current_user)
issuable_metadata: issuable_meta_data(issues, 'Issue', current_user),
include_subscribed: false
}

present issues, options
Expand Down
8 changes: 8 additions & 0 deletions spec/requests/api/issues/get_project_issues_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,14 @@
expect_paginated_array_response([closed_issue.id, confidential_issue.id, issue.id])
end

it 'exposes known attributes' do
get api("#{base_url}/issues", user)

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

context 'issues_statistics' do
context 'no state is treated as all state' do
let(:params) { {} }
Expand Down

0 comments on commit bbd3902

Please sign in to comment.