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
Tatuya Kamada
gitlab-ce
Commits
9a24db12
Commit
9a24db12
authored
Jan 29, 2017
by
wendy0402
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix issue creation from milestone doesn't assign the milestone
parent
edb8ed36
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
3 deletions
+25
-3
app/services/issues/build_service.rb
app/services/issues/build_service.rb
+9
-1
changelogs/unreleased/fix_issue_from_milestone.yml
changelogs/unreleased/fix_issue_from_milestone.yml
+4
-0
spec/services/issues/build_service_spec.rb
spec/services/issues/build_service_spec.rb
+10
-1
spec/services/issues/create_service_spec.rb
spec/services/issues/create_service_spec.rb
+1
-0
spec/support/services/issuable_create_service_slash_commands_shared_examples.rb
...issuable_create_service_slash_commands_shared_examples.rb
+1
-1
No files found.
app/services/issues/build_service.rb
View file @
9a24db12
...
...
@@ -44,7 +44,15 @@ module Issues
end
def
issue_params
@issue_params
||=
issue_params_with_info_from_merge_request
.
merge
(
params
.
slice
(
:title
,
:description
))
@issue_params
||=
issue_params_with_info_from_merge_request
.
merge
(
whitelisted_issue_params
)
end
def
whitelisted_issue_params
if
can?
(
current_user
,
:admin_issue
,
project
)
params
.
slice
(
:title
,
:description
,
:milestone_id
)
else
params
.
slice
(
:title
,
:description
)
end
end
end
end
changelogs/unreleased/fix_issue_from_milestone.yml
0 → 100644
View file @
9a24db12
---
title
:
fix milestone does not automatically assign when create issue from milestone
merge_request
:
author
:
spec/services/issues/build_service_spec.rb
View file @
9a24db12
...
...
@@ -120,11 +120,20 @@ describe Issues::BuildService, services: true do
end
describe
'#execute'
do
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
it
'builds a new issues with given params'
do
issue
=
described_class
.
new
(
project
,
user
,
title:
'Issue #1'
,
description:
'Issue description'
).
execute
issue
=
described_class
.
new
(
project
,
user
,
title:
'Issue #1'
,
description:
'Issue description'
,
milestone_id:
milestone
.
id
,
).
execute
expect
(
issue
.
title
).
to
eq
(
'Issue #1'
)
expect
(
issue
.
description
).
to
eq
(
'Issue description'
)
expect
(
issue
.
milestone
).
to
eq
(
milestone
)
end
end
end
spec/services/issues/create_service_spec.rb
View file @
9a24db12
...
...
@@ -46,6 +46,7 @@ describe Issues::CreateService, services: true do
expect
(
issue
).
to
be_persisted
expect
(
issue
.
title
).
to
eq
(
'Awesome issue'
)
expect
(
issue
.
description
).
to
eq
(
'please fix'
)
expect
(
issue
.
assignee
).
to
be_nil
expect
(
issue
.
labels
).
to
be_empty
expect
(
issue
.
milestone
).
to
be_nil
...
...
spec/support/services/issuable_create_service_slash_commands_shared_examples.rb
View file @
9a24db12
...
...
@@ -58,7 +58,7 @@ shared_examples 'new issuable record that supports slash commands' do
let
(
:example_params
)
do
{
assignee:
create
(
:user
),
milestone_id:
double
(
:milestone
)
,
milestone_id:
1
,
description:
%(/assign @#{assignee.username}\n/milestone %"#{milestone.name}")
}
end
...
...
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