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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
69b89d4e
Commit
69b89d4e
authored
Feb 15, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new system note used when issue has been moved
parent
b53d9f8a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
0 deletions
+42
-0
app/services/issues/move_service.rb
app/services/issues/move_service.rb
+1
-0
app/services/system_note_service.rb
app/services/system_note_service.rb
+17
-0
spec/services/issues/move_service_spec.rb
spec/services/issues/move_service_spec.rb
+4
-0
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+20
-0
No files found.
app/services/issues/move_service.rb
View file @
69b89d4e
...
...
@@ -36,6 +36,7 @@ module Issues
end
def
add_note_moved_to
SystemNoteService
.
issue_moved_to_another_project
(
@issue_old
,
@project
,
@project_new
,
@current_user
)
end
end
end
app/services/system_note_service.rb
View file @
69b89d4e
...
...
@@ -387,4 +387,21 @@ class SystemNoteService
body
=
"Marked the task **
#{
new_task
.
source
}
** as
#{
status_label
}
"
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
end
# Called when issue has been moved to another project
#
# issue - Issue that has been moved to another project
# project_from - Source project of the issue
# project_to - Destination project for the issue
# author - User performing the move
#
# Example Note text:
#
# "This issue has been moved to SomeNamespace / SomeProject"
#
# Returns the created Note object
def
self
.
issue_moved_to_another_project
(
issue
,
project_from
,
project_to
,
author
)
body
=
"This issue has been moved to
#{
project_to
.
to_reference
}
by
#{
author
.
to_reference
}
"
create_note
(
noteable:
issue
,
project:
project_from
,
author:
author
,
note:
body
)
end
end
spec/services/issues/move_service_spec.rb
View file @
69b89d4e
...
...
@@ -18,5 +18,9 @@ describe Issues::MoveService, services: true do
it
'should create a new issue in a new project'
do
expect
(
new_issue
.
project
).
to
eq
new_project
end
it
'should add system note to old issue'
do
expect
(
issue
.
notes
.
last
.
note
).
to
match
/This issue has been moved to/
end
end
end
spec/services/system_note_service_spec.rb
View file @
69b89d4e
...
...
@@ -441,6 +441,26 @@ describe SystemNoteService, services: true do
end
end
describe
'.issue_moved_to_another_project'
do
subject
do
described_class
.
issue_moved_to_another_project
(
noteable
,
project
,
new_project
,
author
)
end
let
(
:new_project
)
{
create
(
:project
)
}
it
'should notify about issue being moved'
do
expect
(
subject
.
note
).
to
match
/This issue has been moved to/
end
it
'should mention destination project'
do
expect
(
subject
.
note
).
to
include
new_project
.
to_reference
end
it
'should mention author of that change'
do
expect
(
subject
.
note
).
to
include
author
.
to_reference
end
end
include
JiraServiceHelper
describe
'JIRA integration'
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