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
c08a14c3
Commit
c08a14c3
authored
Aug 03, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes all list-labels when moving to Backlog/Done
parent
9e5a305f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
11 deletions
+26
-11
app/services/boards/issues/move_service.rb
app/services/boards/issues/move_service.rb
+17
-2
spec/services/boards/issues/move_service_spec.rb
spec/services/boards/issues/move_service_spec.rb
+9
-9
No files found.
app/services/boards/issues/move_service.rb
View file @
c08a14c3
...
...
@@ -45,10 +45,25 @@ module Boards
def
issue_params
{
add_label_ids:
[
moving_to
.
label_id
].
compact
,
remove_label_ids:
[
moving_from
.
label_id
].
compact
add_label_ids:
add_label_ids
,
remove_label_ids:
remove_label_ids
}
end
def
add_label_ids
[
moving_to
.
label_id
].
compact
end
def
remove_label_ids
label_ids
=
if
moving_to
.
label?
moving_from
.
label_id
else
board
.
lists
.
label
.
pluck
(
:label_id
)
end
Array
(
label_ids
).
compact
end
end
end
end
spec/services/boards/issues/move_service_spec.rb
View file @
c08a14c3
...
...
@@ -10,10 +10,10 @@ describe Boards::Issues::MoveService, services: true do
let
(
:development
)
{
create
(
:label
,
project:
project
,
name:
'Development'
)
}
let
(
:testing
)
{
create
(
:label
,
project:
project
,
name:
'Testing'
)
}
let
(
:backlog
)
{
create
(
:backlog_list
,
board:
board
)
}
let
(
:list1
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
0
)
}
let
(
:list2
)
{
create
(
:list
,
board:
board
,
label:
testing
,
position:
1
)
}
let
(
:done
)
{
create
(
:done_list
,
board:
board
)
}
let
!
(
:backlog
)
{
create
(
:backlog_list
,
board:
board
)
}
let
!
(
:list1
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
0
)
}
let
!
(
:list2
)
{
create
(
:list
,
board:
board
,
label:
testing
,
position:
1
)
}
let
!
(
:done
)
{
create
(
:done_list
,
board:
board
)
}
before
do
project
.
team
<<
[
user
,
:developer
]
...
...
@@ -31,8 +31,8 @@ describe Boards::Issues::MoveService, services: true do
end
context
'when moving to backlog'
do
it
'remove
the label of the list it came from
'
do
issue
=
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
,
development
])
it
'remove
s all list-labels
'
do
issue
=
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
,
development
,
testing
])
params
=
{
id:
issue
.
iid
,
from:
list1
.
id
,
to:
backlog
.
id
}
described_class
.
new
(
project
,
user
,
params
).
execute
...
...
@@ -64,7 +64,7 @@ describe Boards::Issues::MoveService, services: true do
described_class
.
new
(
project
,
user
,
params
).
execute
end
it
'removes the label from the list it came from and adds the label of the list it goes to'
do
it
'removes
s
the label from the list it came from and adds the label of the list it goes to'
do
described_class
.
new
(
project
,
user
,
params
).
execute
expect
(
issue
.
reload
.
labels
).
to
contain_exactly
(
bug
,
testing
)
...
...
@@ -72,7 +72,7 @@ describe Boards::Issues::MoveService, services: true do
end
context
'when moving to done'
do
let
(
:issue
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
,
testing
])
}
let
(
:issue
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
,
development
,
testing
])
}
let
(
:params
)
{
{
id:
issue
.
iid
,
from:
list2
.
id
,
to:
done
.
id
}
}
it
'delegates the close proceedings to Issues::CloseService'
do
...
...
@@ -81,7 +81,7 @@ describe Boards::Issues::MoveService, services: true do
described_class
.
new
(
project
,
user
,
params
).
execute
end
it
'remove
the label of the list it came from
and close the issue'
do
it
'remove
s all list-labels
and close the issue'
do
described_class
.
new
(
project
,
user
,
params
).
execute
issue
.
reload
...
...
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