Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-04 20:20:26 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-17 18:58:58 +0300
commit5317f6ea943c84ec0dc68a934f953e667fae1178 (patch)
treefb29089d8f2ecb9667e68e144c5f1ab32c039566
parenta8b2d7f380a2d87557e278011fb91044de103d02 (diff)
Include the Issue#assignee in the response when listing issues
-rw-r--r--app/controllers/projects/board_issues_controller.rb7
-rw-r--r--spec/controllers/projects/board_issues_controller_spec.rb3
-rw-r--r--spec/fixtures/api/schemas/issue.json6
3 files changed, 14 insertions, 2 deletions
diff --git a/app/controllers/projects/board_issues_controller.rb b/app/controllers/projects/board_issues_controller.rb
index cdaaacfbbd4..fdc3a8795ef 100644
--- a/app/controllers/projects/board_issues_controller.rb
+++ b/app/controllers/projects/board_issues_controller.rb
@@ -7,7 +7,12 @@ class Projects::BoardIssuesController < Projects::ApplicationController
issues = Boards::Issues::ListService.new(project, current_user, filter_params).execute
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
def update
diff --git a/spec/controllers/projects/board_issues_controller_spec.rb b/spec/controllers/projects/board_issues_controller_spec.rb
index 6b4fb382b16..44a20411abc 100644
--- a/spec/controllers/projects/board_issues_controller_spec.rb
+++ b/spec/controllers/projects/board_issues_controller_spec.rb
@@ -18,9 +18,10 @@ describe Projects::BoardIssuesController do
describe 'GET #index' do
context 'with valid list id' 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: [development])
- create(:labeled_issue, project: project, labels: [development])
+ create(:labeled_issue, project: project, labels: [development], assignee: johndoe)
list_issues list_id: list2
diff --git a/spec/fixtures/api/schemas/issue.json b/spec/fixtures/api/schemas/issue.json
index 0a9bf4e0fb7..3da9b241047 100644
--- a/spec/fixtures/api/schemas/issue.json
+++ b/spec/fixtures/api/schemas/issue.json
@@ -24,6 +24,12 @@
},
"title": { "type": "string" }
}
+ },
+ "assignee": {
+ "id": { "type": "integet" },
+ "name": { "type": "string" },
+ "username": { "type": "string" },
+ "avatar_url": { "type": "uri" }
}
},
"additionalProperties": false