[API] Fix creating issue when assignee_id is empty
see https://gitlab.com/gitlab-org/gitlab-ce/issues/42025
This commit is contained in:
parent
cedbf9c8b4
commit
1b1cc6fb14
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: "[API] Fix creating issue when assignee_id is empty"
|
||||||
|
merge_request:
|
||||||
|
author:
|
||||||
|
type: fixed
|
|
@ -3,8 +3,10 @@ module API
|
||||||
module CommonHelpers
|
module CommonHelpers
|
||||||
def convert_parameters_from_legacy_format(params)
|
def convert_parameters_from_legacy_format(params)
|
||||||
params.tap do |params|
|
params.tap do |params|
|
||||||
if params[:assignee_id].present?
|
assignee_id = params.delete(:assignee_id)
|
||||||
params[:assignee_ids] = [params.delete(:assignee_id)]
|
|
||||||
|
if assignee_id.present?
|
||||||
|
params[:assignee_ids] = [assignee_id]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -847,6 +847,15 @@ describe API::Issues, :mailer do
|
||||||
expect(json_response['assignee']['name']).to eq(user2.name)
|
expect(json_response['assignee']['name']).to eq(user2.name)
|
||||||
expect(json_response['assignees'].first['name']).to eq(user2.name)
|
expect(json_response['assignees'].first['name']).to eq(user2.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'creates a new project issue when assignee_id is empty' do
|
||||||
|
post api("/projects/#{project.id}/issues", user),
|
||||||
|
title: 'new issue', assignee_id: ''
|
||||||
|
|
||||||
|
expect(response).to have_gitlab_http_status(201)
|
||||||
|
expect(json_response['title']).to eq('new issue')
|
||||||
|
expect(json_response['assignee']).to be_nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'single assignee restrictions' do
|
context 'single assignee restrictions' do
|
||||||
|
|
Loading…
Reference in New Issue