Include the Issue#assignee in the response when listing issues
This commit is contained in:
parent
a8b2d7f380
commit
5317f6ea94
3 changed files with 14 additions and 2 deletions
|
@ -7,7 +7,12 @@ class Projects::BoardIssuesController < Projects::ApplicationController
|
||||||
issues = Boards::Issues::ListService.new(project, current_user, filter_params).execute
|
issues = Boards::Issues::ListService.new(project, current_user, filter_params).execute
|
||||||
issues = issues.page(params[:page])
|
issues = issues.page(params[:page])
|
||||||
|
|
||||||
render json: issues.as_json(only: [:iid, :title, :confidential], include: { labels: { only: [:id, :title, :color] } })
|
render json: issues.as_json(
|
||||||
|
only: [:iid, :title, :confidential],
|
||||||
|
include: {
|
||||||
|
assignee: { only: [:id, :name, :username], methods: [:avatar_url] },
|
||||||
|
labels: { only: [:id, :title, :color] }
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
|
@ -18,9 +18,10 @@ describe Projects::BoardIssuesController do
|
||||||
describe 'GET #index' do
|
describe 'GET #index' do
|
||||||
context 'with valid list id' do
|
context 'with valid list id' do
|
||||||
it 'returns issues that have the list label applied' do
|
it 'returns issues that have the list label applied' do
|
||||||
|
johndoe = create(:user, avatar: fixture_file_upload(File.join(Rails.root, 'spec/fixtures/dk.png')))
|
||||||
create(:labeled_issue, project: project, labels: [planning])
|
create(:labeled_issue, project: project, labels: [planning])
|
||||||
create(:labeled_issue, project: project, labels: [development])
|
create(:labeled_issue, project: project, labels: [development])
|
||||||
create(:labeled_issue, project: project, labels: [development])
|
create(:labeled_issue, project: project, labels: [development], assignee: johndoe)
|
||||||
|
|
||||||
list_issues list_id: list2
|
list_issues list_id: list2
|
||||||
|
|
||||||
|
|
6
spec/fixtures/api/schemas/issue.json
vendored
6
spec/fixtures/api/schemas/issue.json
vendored
|
@ -24,6 +24,12 @@
|
||||||
},
|
},
|
||||||
"title": { "type": "string" }
|
"title": { "type": "string" }
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"assignee": {
|
||||||
|
"id": { "type": "integet" },
|
||||||
|
"name": { "type": "string" },
|
||||||
|
"username": { "type": "string" },
|
||||||
|
"avatar_url": { "type": "uri" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
|
Loading…
Reference in a new issue