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
Jérome Perrin
gitlab-ce
Commits
93812f25
Commit
93812f25
authored
Mar 14, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add initial notifications and hooks for issue move
parent
58df72fa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
13 deletions
+38
-13
app/assets/javascripts/project_select.js.coffee
app/assets/javascripts/project_select.js.coffee
+0
-6
app/services/issues/move_service.rb
app/services/issues/move_service.rb
+30
-7
app/services/notification_service.rb
app/services/notification_service.rb
+8
-0
No files found.
app/assets/javascripts/project_select.js.coffee
View file @
93812f25
...
...
@@ -51,9 +51,6 @@ class @ProjectSelect
accessLevelCallbackDecorator
:
(
callback
)
=>
return
callback
unless
@
accessLevel
##
# Requires ECMAScript >= 5
#
(
projects
)
=>
data
=
projects
.
filter
(
p
)
=>
max
=
Math
.
max
(
p
.
permissions
.
group_access
?
.
access_level
?
0
,
...
...
@@ -66,9 +63,6 @@ class @ProjectSelect
withoutIdCallbackDecorator
:
(
callback
)
=>
return
callback
unless
@
withoutId
##
# Requires ECMAScript >= 5
#
(
projects
)
=>
data
=
projects
.
filter
(
p
)
=>
p
.
id
!=
@
withoutId
...
...
app/services/issues/move_service.rb
View file @
93812f25
...
...
@@ -6,7 +6,7 @@ module Issues
@issue_old
=
issue
@issue_new
=
issue
.
dup
@project_old
=
@project
@project_new
=
Project
.
find
(
new_project_id
)
if
new_project_id
@project_new
=
Project
.
find
(
new_project_id
)
end
def
execute
...
...
@@ -25,9 +25,10 @@ module Issues
close_old_issue
end
# Notifications
# Notifications
and hooks
#
notify_participants
# notify_participants
# trigger_hooks_and_events
@issue_new
end
...
...
@@ -44,10 +45,18 @@ module Issues
end
def
create_new_issue
@issue_new
.
iid
=
nil
@issue_new
.
project
=
@project_new
# Reset internal ID, will be regenerated before save
#
@issue_new
.
iid
=
nil
# Reset labels and milestones, as those are not valid in context
# of a new project
#
@issue_new
.
labels
=
[]
@issue_new
.
milestone
=
nil
@issue_new
.
description
=
rewrite_references
(
@issue_old
)
@issue_new
.
save!
end
...
...
@@ -66,9 +75,6 @@ module Issues
@issue_old
.
update
(
state: :closed
)
end
def
notify_participants
end
def
add_moved_from_note
SystemNoteService
.
noteable_moved
(
:from
,
@issue_new
,
@project_new
,
@issue_old
,
@current_user
)
...
...
@@ -95,5 +101,22 @@ module Issues
raise
'Unexpected noteable while moving an issue'
end
end
def
trigger_hooks_and_events
event_service
.
close_issue
(
@issue_old
,
@current_user
)
event_service
.
open_issue
(
@issue_new
,
@current_user
)
@issue_new
.
create_cross_references!
(
@current_user
)
execute_hooks
(
@issue_old
,
'close'
)
execute_hooks
(
@issue_new
,
'open'
)
end
def
notify_participants
todo_service
.
close_issue
(
@issue_old
,
@current_user
)
todo_service
.
open_issue
(
@issue_new
,
@current_user
)
notification_service
.
issue_moved
(
@issue_old
,
@issue_new
,
@current_user
)
end
end
end
app/services/notification_service.rb
View file @
93812f25
...
...
@@ -236,6 +236,14 @@ class NotificationService
end
end
def
issue_moved
(
issue
,
old_project
,
new_project
,
current_user
)
recipients
=
build_recipients
(
issue
,
old_project
,
current_user
)
recipients
.
each
do
|
recipient
|
mailer
.
send
(
'issue_moved'
,
recipient
.
id
,
issue
.
id
,
current_user
.
id
).
deliver_later
end
end
protected
# Get project users with WATCH notification level
...
...
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