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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
9728d2b2
Commit
9728d2b2
authored
Jul 18, 2019
by
Eugenia Grieff
Committed by
Bob Van Landuyt
Jul 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Milestones should not be set on epics (issue promotion)"
parent
21bab0e2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
73 additions
and
18 deletions
+73
-18
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+7
-0
app/services/issuable/clone/attributes_rewriter.rb
app/services/issuable/clone/attributes_rewriter.rb
+2
-0
ee/app/models/concerns/ee/issuable.rb
ee/app/models/concerns/ee/issuable.rb
+5
-0
ee/changelogs/unreleased/10270-milestones-should-not-be-set-on-epics-issue-promotion.yml
...milestones-should-not-be-set-on-epics-issue-promotion.yml
+5
-0
ee/spec/models/concerns/ee/issuable_spec.rb
ee/spec/models/concerns/ee/issuable_spec.rb
+13
-0
ee/spec/services/ee/issuable/clone/attributes_rewriter_spec.rb
...ec/services/ee/issuable/clone/attributes_rewriter_spec.rb
+20
-18
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+21
-0
No files found.
app/models/concerns/issuable.rb
View file @
9728d2b2
...
...
@@ -427,6 +427,13 @@ module Issuable
def
wipless_title_changed
(
old_title
)
old_title
!=
title
end
##
# Overridden on EE module
#
def
supports_milestone?
respond_to?
(
:milestone_id
)
end
end
Issuable
.
prepend
(
EE
::
Issuable
)
# rubocop: disable Cop/InjectEnterpriseEditionModule
...
...
app/services/issuable/clone/attributes_rewriter.rb
View file @
9728d2b2
...
...
@@ -17,6 +17,8 @@ module Issuable
private
def
cloneable_milestone
return
unless
new_entity
.
supports_milestone?
title
=
original_entity
.
milestone
&
.
title
return
unless
title
...
...
ee/app/models/concerns/ee/issuable.rb
View file @
9728d2b2
...
...
@@ -25,6 +25,11 @@ module EE
super
end
override
:supports_milestone?
def
supports_milestone?
super
&&
!
is_a?
(
Epic
)
end
def
supports_epic?
is_a?
(
Issue
)
&&
project
.
group
end
...
...
ee/changelogs/unreleased/10270-milestones-should-not-be-set-on-epics-issue-promotion.yml
0 → 100644
View file @
9728d2b2
---
title
:
Do not include milestone attribute when promoting issue to epic
merge_request
:
14532
author
:
type
:
fixed
ee/spec/models/concerns/ee/issuable_spec.rb
View file @
9728d2b2
...
...
@@ -37,4 +37,17 @@ describe EE::Issuable do
end
end
end
describe
'#supports_milestone?'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
context
"for epics"
do
let
(
:epic
)
{
build
(
:epic
)
}
it
'returns false'
do
expect
(
epic
.
supports_milestone?
).
to
be_falsy
end
end
end
end
ee/spec/services/ee/issuable/clone/attributes_rewriter_spec.rb
View file @
9728d2b2
...
...
@@ -9,33 +9,35 @@ describe Issuable::Clone::AttributesRewriter do
let
(
:original_issue
)
{
create
(
:issue
,
project:
project
)
}
context
'when a new object is a group entity'
do
let
(
:new_epic
)
{
create
(
:epic
,
group:
group
)
}
context
'when entity is an epic'
do
let
(
:new_epic
)
{
create
(
:epic
,
group:
group
)
}
subject
{
described_class
.
new
(
user
,
original_issue
,
new_epic
)
}
subject
{
described_class
.
new
(
user
,
original_issue
,
new_epic
)
}
context
'setting labels'
do
let!
(
:project_label1
)
{
create
(
:label
,
title:
'label1'
,
project:
project
)
}
let!
(
:project_label2
)
{
create
(
:label
,
title:
'label2'
,
project:
project
)
}
let!
(
:group_label1
)
{
create
(
:group_label
,
title:
'group_label'
,
group:
group
)
}
let!
(
:group_label2
)
{
create
(
:group_label
,
title:
'label2'
,
group:
group
)
}
context
'setting labels'
do
let
(
:project_label1
)
{
create
(
:label
,
title:
'label1'
,
project:
project
)
}
let!
(
:project_label2
)
{
create
(
:label
,
title:
'label2'
,
project:
project
)
}
let
(
:group_label1
)
{
create
(
:group_label
,
title:
'group_label'
,
group:
group
)
}
let!
(
:group_label2
)
{
create
(
:group_label
,
title:
'label2'
,
group:
group
)
}
it
'keeps group labels and merges project labels where possible'
do
original_issue
.
update
(
labels:
[
project_label1
,
project_label2
,
group_label1
])
it
'keeps group labels and merges project labels where possible'
do
original_issue
.
update
(
labels:
[
project_label1
,
project_label2
,
group_label1
])
subject
.
execute
subject
.
execute
expect
(
new_epic
.
reload
.
labels
).
to
match_array
([
group_label1
,
group_label2
])
expect
(
new_epic
.
reload
.
labels
).
to
match_array
([
group_label1
,
group_label2
])
end
end
end
context
'setting milestones'
do
it
'sets milestone to nil when old issue milestone is not a group milestone
'
do
milestone
=
create
(
:milestone
,
title:
'milestone'
,
project:
project
)
original_issue
.
update
(
milestone:
milestone
)
context
'setting milestones'
do
it
'sets milestone attribute as nil
'
do
milestone
=
create
(
:milestone
,
title:
'milestone'
,
group:
group
)
original_issue
.
update
(
milestone:
milestone
)
subject
.
execute
expect
(
new_epic
).
to
receive
(
:update
).
with
(
labels:
[],
milestone:
nil
)
expect
(
new_epic
.
reload
.
milestone
).
to
be_nil
subject
.
execute
end
end
end
end
...
...
spec/models/concerns/issuable_spec.rb
View file @
9728d2b2
...
...
@@ -774,4 +774,25 @@ describe Issuable do
end
end
end
describe
'#supports_milestone?'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
context
"for issues"
do
let
(
:issue
)
{
build
(
:issue
,
project:
project
)
}
it
'returns true'
do
expect
(
issue
.
supports_milestone?
).
to
be_truthy
end
end
context
"for merge requests"
do
let
(
:merge_request
)
{
build
(
:merge_request
,
target_project:
project
,
source_project:
project
)
}
it
'returns true'
do
expect
(
merge_request
.
supports_milestone?
).
to
be_truthy
end
end
end
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