Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
1b1cc6fb
Commit
1b1cc6fb
authored
Jan 15, 2018
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API] Fix creating issue when assignee_id is empty
see
https://gitlab.com/gitlab-org/gitlab-ce/issues/42025
parent
cedbf9c8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
+18
-2
changelogs/unreleased/42025-fix-issue-api.yml
changelogs/unreleased/42025-fix-issue-api.yml
+5
-0
lib/api/helpers/common_helpers.rb
lib/api/helpers/common_helpers.rb
+4
-2
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+9
-0
No files found.
changelogs/unreleased/42025-fix-issue-api.yml
0 → 100644
View file @
1b1cc6fb
---
title
:
"
[API]
Fix
creating
issue
when
assignee_id
is
empty"
merge_request
:
author
:
type
:
fixed
lib/api/helpers/common_helpers.rb
View file @
1b1cc6fb
...
@@ -3,8 +3,10 @@ module API
...
@@ -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
...
...
spec/requests/api/issues_spec.rb
View file @
1b1cc6fb
...
@@ -847,6 +847,15 @@ describe API::Issues, :mailer do
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment