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
bab50e01
Commit
bab50e01
authored
Mar 23, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preserve time notes has been updated at when moving issue
parent
703f7c5d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
app/services/issues/move_service.rb
app/services/issues/move_service.rb
+2
-1
spec/services/issues/move_service_spec.rb
spec/services/issues/move_service_spec.rb
+19
-2
No files found.
app/services/issues/move_service.rb
View file @
bab50e01
...
@@ -54,7 +54,8 @@ module Issues
...
@@ -54,7 +54,8 @@ module Issues
new_note
=
note
.
dup
new_note
=
note
.
dup
new_params
=
{
project:
@new_project
,
noteable:
@new_issue
,
new_params
=
{
project:
@new_project
,
noteable:
@new_issue
,
note:
unfold_references
(
new_note
.
note
),
note:
unfold_references
(
new_note
.
note
),
created_at:
note
.
created_at
}
created_at:
note
.
created_at
,
updated_at:
note
.
updated_at
}
new_note
.
update
(
new_params
)
new_note
.
update
(
new_params
)
end
end
...
...
spec/services/issues/move_service_spec.rb
View file @
bab50e01
...
@@ -85,6 +85,10 @@ describe Issues::MoveService, services: true do
...
@@ -85,6 +85,10 @@ describe Issues::MoveService, services: true do
expect
(
old_issue
.
moved?
).
to
eq
true
expect
(
old_issue
.
moved?
).
to
eq
true
expect
(
old_issue
.
moved_to
).
to
eq
new_issue
expect
(
old_issue
.
moved_to
).
to
eq
new_issue
end
end
it
'preserves create time'
do
expect
(
old_issue
.
created_at
).
to
eq
new_issue
.
created_at
end
end
end
context
'issue with notes'
do
context
'issue with notes'
do
...
@@ -121,10 +125,23 @@ describe Issues::MoveService, services: true do
...
@@ -121,10 +125,23 @@ describe Issues::MoveService, services: true do
it
'preserves orignal author of comment'
do
it
'preserves orignal author of comment'
do
expect
(
user_notes
.
pluck
(
:author_id
)).
to
all
(
eq
(
author
.
id
))
expect
(
user_notes
.
pluck
(
:author_id
)).
to
all
(
eq
(
author
.
id
))
end
end
end
context
'note that has been updated'
do
let!
(
:note
)
do
create
(
:note
,
noteable:
old_issue
,
project:
old_project
,
author:
author
,
updated_at:
Date
.
yesterday
,
created_at:
Date
.
yesterday
)
end
include_context
'issue move executed'
it
'preserves time when note has been created at'
do
it
'preserves time when note has been created at'
do
expect
(
old_issue
.
notes
.
first
.
created_at
)
expect
(
new_issue
.
notes
.
first
.
created_at
).
to
eq
note
.
created_at
.
to
eq
new_issue
.
notes
.
first
.
created_at
end
it
'preserves time when note has been updated at'
do
expect
(
new_issue
.
notes
.
first
.
updated_at
).
to
eq
note
.
updated_at
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