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
Boxiang Sun
gitlab-ce
Commits
b53d9f8a
Commit
b53d9f8a
authored
Feb 15, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add scaffold of service that moves issue to another project
parent
c280edd3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
app/services/issues/move_service.rb
app/services/issues/move_service.rb
+41
-0
spec/services/issues/move_service_spec.rb
spec/services/issues/move_service_spec.rb
+22
-0
No files found.
app/services/issues/move_service.rb
0 → 100644
View file @
b53d9f8a
module
Issues
class
MoveService
<
Issues
::
BaseService
def
execute
(
issue_old
,
project_new
)
@issue_old
=
issue_old
@issue_new
=
issue_old
.
dup
@project_new
=
project_new
open_new_issue
rewrite_notes
close_old_issue
notify_participants
@issue_new
end
private
def
open_new_issue
@issue_new
.
project
=
@project_new
@issue_new
.
save!
add_note_moved_from
end
def
rewrite_notes
end
def
close_old_issue
add_note_moved_to
end
def
notify_participants
end
def
add_note_moved_from
end
def
add_note_moved_to
end
end
end
spec/services/issues/move_service_spec.rb
0 → 100644
View file @
b53d9f8a
require
'spec_helper'
describe
Issues
::
MoveService
,
services:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
title:
'Some issue'
,
description:
'Some issue description'
)
}
let
(
:current_project
)
{
issue
.
project
}
let
(
:new_project
)
{
create
(
:project
)
}
before
do
current_project
.
team
<<
[
user
,
:master
]
end
describe
'#execute'
do
let!
(
:new_issue
)
do
described_class
.
new
(
current_project
,
user
).
execute
(
issue
,
new_project
)
end
it
'should create a new issue in a new project'
do
expect
(
new_issue
.
project
).
to
eq
new_project
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