Commit 0e09fdc9 authored by Valery Sizov's avatar Valery Sizov

[Multiple issue assignees] fix v4 API for issues

parent 4a35d4b6
......@@ -40,7 +40,7 @@ module IssuableCollections
end
def issues_collection
issues_finder.execute.preload(:project, :author, :labels, :milestone, :assignees, project: :namespace)
issues_finder.execute.preload(:project, :author, :assignees, :labels, :milestone, project: :namespace)
end
def merge_requests_collection
......
......@@ -31,7 +31,7 @@ module API
params :issue_params do
optional :description, type: String, desc: 'The description of an issue'
optional :assignee_id, type: Integer, desc: 'The ID of a user to assign issue'
optional :assignee_ids, type: Array[Integer], desc: 'The ID of a user to assign issue'
optional :milestone_id, type: Integer, desc: 'The ID of a milestone to assign issue'
optional :labels, type: String, desc: 'Comma-separated list of label names'
optional :due_date, type: String, desc: 'Date string in the format YEAR-MONTH-DAY'
......@@ -156,7 +156,7 @@ module API
desc: 'Date time when the issue was updated. Available only for admins and project owners.'
optional :state_event, type: String, values: %w[reopen close], desc: 'State of the issue'
use :issue_params
at_least_one_of :title, :description, :assignee_id, :milestone_id,
at_least_one_of :title, :description, :assignee_ids, :milestone_id,
:labels, :created_at, :due_date, :confidential, :state_event,
:weight
end
......
......@@ -33,7 +33,9 @@
},
"additionalProperties": false
},
"assignee": {
"assignees": {
"type": "array",
"items": {
"type": ["object", "null"],
"properties": {
"name": { "type": "string" },
......@@ -44,6 +46,7 @@
"web_url": { "type": "uri" }
},
"additionalProperties": false
}
},
"author": {
"type": "object",
......@@ -68,7 +71,7 @@
"required": [
"id", "iid", "project_id", "title", "description",
"state", "created_at", "updated_at", "labels",
"milestone", "assignee", "author", "user_notes_count",
"milestone", "assignees", "author", "user_notes_count",
"upvotes", "downvotes", "due_date", "confidential",
"web_url", "weight"
],
......
......@@ -788,7 +788,7 @@ describe API::Issues, api: true do
expect(json_response['updated_at']).to be_present
expect(json_response['labels']).to eq(issue.label_names)
expect(json_response['milestone']).to be_a Hash
expect(json_response['assignee']).to be_a Hash
expect(json_response['assignees']).to be_a Array
expect(json_response['author']).to be_a Hash
expect(json_response['confidential']).to be_falsy
expect(json_response['weight']).to be_nil
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment