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
8d3f072e
Commit
8d3f072e
authored
Feb 24, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take care about data being rewritten when moving issue
parent
fbb5a8b0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
app/services/issues/move_service.rb
app/services/issues/move_service.rb
+1
-3
spec/services/issues/move_service_spec.rb
spec/services/issues/move_service_spec.rb
+19
-1
No files found.
app/services/issues/move_service.rb
View file @
8d3f072e
...
...
@@ -49,9 +49,7 @@ module Issues
def
new_issue_params
new_params
=
{
id:
nil
,
iid:
nil
,
milestone_id:
nil
,
label_ids:
[],
project_id:
@project_new
.
id
,
author_id:
@issue_old
.
author_id
,
description:
rewrite_references
(
@issue_old
),
updated_by_id:
current_user
.
id
}
description:
rewrite_references
(
@issue_old
)
}
params
.
merge
(
new_params
)
end
...
...
spec/services/issues/move_service_spec.rb
View file @
8d3f072e
...
...
@@ -2,13 +2,18 @@ require 'spec_helper'
describe
Issues
::
MoveService
,
services:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:author
)
{
create
(
:user
)
}
let
(
:title
)
{
'Some issue'
}
let
(
:description
)
{
'Some issue description'
}
let
(
:old_project
)
{
create
(
:project
)
}
let
(
:old_issue
)
{
create
(
:issue
,
title:
title
,
description:
description
,
project:
old_project
)
}
let
(
:new_project
)
{
create
(
:project
)
}
let
(
:issue_params
)
{
old_issue
.
serializable_hash
}
let
(
:old_issue
)
do
create
(
:issue
,
title:
title
,
description:
description
,
project:
old_project
,
author:
author
)
end
let
(
:move_service
)
do
described_class
.
new
(
old_project
,
user
,
issue_params
,
old_issue
,
new_project_id
)
end
...
...
@@ -73,6 +78,19 @@ describe Issues::MoveService, services: true do
expect
(
old_issue
.
changed?
).
to
be
false
expect
(
new_issue
.
changed?
).
to
be
false
end
it
'changes author'
do
expect
(
new_issue
.
author
).
to
eq
user
end
it
'removes data that is invalid in new context'
do
expect
(
new_issue
.
milestone
).
to
be_nil
expect
(
new_issue
.
labels
).
to
be_empty
end
it
'creates a new internal id for issue'
do
expect
(
new_issue
.
iid
).
to
be
1
end
end
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