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
5ed8a1e1
Commit
5ed8a1e1
authored
Feb 22, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Silently close old issue when it has been moved
parent
8a024494
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
app/services/issues/move_service.rb
app/services/issues/move_service.rb
+5
-7
spec/services/issues/move_service_spec.rb
spec/services/issues/move_service_spec.rb
+9
-0
No files found.
app/services/issues/move_service.rb
View file @
5ed8a1e1
...
...
@@ -23,8 +23,8 @@ module Issues
# Old issue tasks
#
close_old_issue
add_moved_to_note
close_old_issue
# Notifications
#
...
...
@@ -45,20 +45,18 @@ module Issues
end
def
open_new_issue
@issue_new
.
project
=
@project_new
@issue_new
.
save!
@issue_new
.
update
(
project:
@project_new
)
end
def
rewrite_notes
@issue_old
.
notes
.
find_each
do
|
note
|
note_new
=
note
.
dup
note_new
.
project
=
@project_new
note_new
.
noteable
=
@issue_new
note_new
.
save!
new_note
=
note
.
dup
new_note
.
update
(
project:
@project_new
,
noteable:
@issue_new
)
end
end
def
close_old_issue
@issue_old
.
update
(
state: :closed
)
end
def
notify_participants
...
...
spec/services/issues/move_service_spec.rb
View file @
5ed8a1e1
...
...
@@ -56,6 +56,15 @@ describe Issues::MoveService, services: true do
it
'adds system note to new issue at the end'
do
expect
(
new_issue
.
notes
.
last
.
note
).
to
match
/^Moved from/
end
it
'closes old issue'
do
expect
(
old_issue
.
closed?
).
to
be
true
end
it
'persists changes to old and new issue'
do
expect
(
new_issue
.
changed?
).
to
be
false
expect
(
old_issue
.
changed?
).
to
be
false
end
end
context
'notes exist'
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