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
Léo-Paul Géneau
gitlab-ce
Commits
6a3f9cef
Commit
6a3f9cef
authored
Jun 20, 2018
by
Chantal Rollison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep label on issue when moving
parent
70bf08b5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
4 deletions
+30
-4
app/services/issues/move_service.rb
app/services/issues/move_service.rb
+2
-1
changelogs/unreleased/cr-keep-issue-labels.yml
changelogs/unreleased/cr-keep-issue-labels.yml
+5
-0
spec/services/issues/move_service_spec.rb
spec/services/issues/move_service_spec.rb
+23
-3
No files found.
app/services/issues/move_service.rb
View file @
6a3f9cef
...
@@ -58,7 +58,8 @@ module Issues
...
@@ -58,7 +58,8 @@ module Issues
def
cloneable_label_ids
def
cloneable_label_ids
params
=
{
params
=
{
project_id:
@new_project
.
id
,
project_id:
@new_project
.
id
,
title:
@old_issue
.
labels
.
pluck
(
:title
)
title:
@old_issue
.
labels
.
pluck
(
:title
),
include_ancestor_groups:
true
}
}
LabelsFinder
.
new
(
current_user
,
params
).
execute
.
pluck
(
:id
)
LabelsFinder
.
new
(
current_user
,
params
).
execute
.
pluck
(
:id
)
...
...
changelogs/unreleased/cr-keep-issue-labels.yml
0 → 100644
View file @
6a3f9cef
---
title
:
Keeps the label on an issue when the issue is moved.
merge_request
:
20036
author
:
type
:
fixed
spec/services/issues/move_service_spec.rb
View file @
6a3f9cef
...
@@ -5,8 +5,11 @@ describe Issues::MoveService do
...
@@ -5,8 +5,11 @@ describe Issues::MoveService do
let
(
:author
)
{
create
(
:user
)
}
let
(
:author
)
{
create
(
:user
)
}
let
(
:title
)
{
'Some issue'
}
let
(
:title
)
{
'Some issue'
}
let
(
:description
)
{
'Some issue description'
}
let
(
:description
)
{
'Some issue description'
}
let
(
:old_project
)
{
create
(
:project
)
}
let
(
:group
)
{
create
(
:group
,
:private
)
}
let
(
:new_project
)
{
create
(
:project
)
}
let
(
:sub_group_1
)
{
create
(
:group
,
:private
,
parent:
group
)
}
let
(
:sub_group_2
)
{
create
(
:group
,
:private
,
parent:
group
)
}
let
(
:old_project
)
{
create
(
:project
,
namespace:
sub_group_1
)
}
let
(
:new_project
)
{
create
(
:project
,
namespace:
sub_group_2
)
}
let
(
:milestone1
)
{
create
(
:milestone
,
project_id:
old_project
.
id
,
title:
'v9.0'
)
}
let
(
:milestone1
)
{
create
(
:milestone
,
project_id:
old_project
.
id
,
title:
'v9.0'
)
}
let
(
:old_issue
)
do
let
(
:old_issue
)
do
...
@@ -14,7 +17,7 @@ describe Issues::MoveService do
...
@@ -14,7 +17,7 @@ describe Issues::MoveService do
project:
old_project
,
author:
author
,
milestone:
milestone1
)
project:
old_project
,
author:
author
,
milestone:
milestone1
)
end
end
le
t
(
:move_service
)
do
subjec
t
(
:move_service
)
do
described_class
.
new
(
old_project
,
user
)
described_class
.
new
(
old_project
,
user
)
end
end
...
@@ -102,6 +105,23 @@ describe Issues::MoveService do
...
@@ -102,6 +105,23 @@ describe Issues::MoveService do
end
end
end
end
context
'issue with group labels'
,
:nested_groups
do
it
'assigns group labels to new issue'
do
label
=
create
(
:group_label
,
group:
group
)
label_issue
=
create
(
:labeled_issue
,
description:
description
,
project:
old_project
,
milestone:
milestone1
,
labels:
[
label
])
old_project
.
add_reporter
(
user
)
new_project
.
add_reporter
(
user
)
new_issue
=
move_service
.
execute
(
label_issue
,
new_project
)
expect
(
new_issue
).
to
have_attributes
(
project:
new_project
,
labels:
include
(
label
)
)
end
end
context
'generic issue'
do
context
'generic issue'
do
include_context
'issue move executed'
include_context
'issue move executed'
...
...
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