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
fab69546
Commit
fab69546
authored
Jun 01, 2016
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move awardables too when issue is moved
parent
91a7b933
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
app/services/issues/move_service.rb
app/services/issues/move_service.rb
+9
-0
spec/services/issues/move_service_spec.rb
spec/services/issues/move_service_spec.rb
+5
-0
No files found.
app/services/issues/move_service.rb
View file @
fab69546
...
@@ -24,6 +24,7 @@ module Issues
...
@@ -24,6 +24,7 @@ module Issues
@new_issue
=
create_new_issue
@new_issue
=
create_new_issue
rewrite_notes
rewrite_notes
rewrite_award_emoji
add_note_moved_from
add_note_moved_from
# Old issue tasks
# Old issue tasks
...
@@ -72,6 +73,14 @@ module Issues
...
@@ -72,6 +73,14 @@ module Issues
end
end
end
end
def
rewrite_award_emoji
@old_issue
.
award_emoji
.
each
do
|
award
|
new_award
=
award
.
dup
new_award
.
awardable
=
@new_issue
new_award
.
save
end
end
def
rewrite_content
(
content
)
def
rewrite_content
(
content
)
return
unless
content
return
unless
content
...
...
spec/services/issues/move_service_spec.rb
View file @
fab69546
...
@@ -39,6 +39,7 @@ describe Issues::MoveService, services: true do
...
@@ -39,6 +39,7 @@ describe Issues::MoveService, services: true do
let!
(
:milestone2
)
do
let!
(
:milestone2
)
do
create
(
:milestone
,
project_id:
new_project
.
id
,
title:
'v9.0'
)
create
(
:milestone
,
project_id:
new_project
.
id
,
title:
'v9.0'
)
end
end
let!
(
:award_emoji
)
{
create
(
:award_emoji
,
awardable:
old_issue
)
}
let!
(
:new_issue
)
{
move_service
.
execute
(
old_issue
,
new_project
)
}
let!
(
:new_issue
)
{
move_service
.
execute
(
old_issue
,
new_project
)
}
end
end
...
@@ -115,6 +116,10 @@ describe Issues::MoveService, services: true do
...
@@ -115,6 +116,10 @@ describe Issues::MoveService, services: true do
it
'preserves create time'
do
it
'preserves create time'
do
expect
(
old_issue
.
created_at
).
to
eq
new_issue
.
created_at
expect
(
old_issue
.
created_at
).
to
eq
new_issue
.
created_at
end
end
it
'moves the award emoji'
do
expect
(
old_issue
.
award_emoji
.
first
.
name
).
to
eq
new_issue
.
reload
.
award_emoji
.
first
.
name
end
end
end
context
'issue with notes'
do
context
'issue with notes'
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