summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-03-15 11:35:40 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-03-17 07:39:16 +0100
commit15d32b6a11380c257180dbc8e2691bc12e2792bc (patch)
tree9be5edc43e8ca447a79c000841b574b034c4d946 /app/services
parenta23f0e8c9ebd3a7922786d2fc4f3450c1fdecad6 (diff)
downloadgitlab-ce-15d32b6a11380c257180dbc8e2691bc12e2792bc.tar.gz
Add new notifications for issue move action
[ci skip]
Diffstat (limited to 'app/services')
-rw-r--r--app/services/issues/move_service.rb9
-rw-r--r--app/services/notification_service.rb10
2 files changed, 17 insertions, 2 deletions
diff --git a/app/services/issues/move_service.rb b/app/services/issues/move_service.rb
index e2089e22bcb..4abcd203407 100644
--- a/app/services/issues/move_service.rb
+++ b/app/services/issues/move_service.rb
@@ -10,13 +10,17 @@ module Issues
if new_project_id
@project_new = Project.find(new_project_id)
end
+
+ if @project_new == @project_old
+ raise StandardError, 'Cannot move issue to project it originates from!'
+ end
end
def execute
return unless move?
- # Using trasaction because of a high footprint on
- # rewriting notes (unfolding references)
+ # Using trasaction because of a high resources footprint
+ # on rewriting notes (unfolding references)
#
ActiveRecord::Base.transaction do
# New issue tasks
@@ -99,6 +103,7 @@ module Issues
end
def notify_participants
+ notification_service.issue_moved(@issue_old, @issue_new, @current_user)
end
end
end
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index 19a6779dea9..3bdf00a8291 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -236,6 +236,16 @@ class NotificationService
end
end
+ def issue_moved(issue, new_issue, current_user)
+ recipients = build_recipients(issue, issue.project, current_user)
+
+ recipients.map do |recipient|
+ email = mailer.issue_moved_email(recipient, issue, new_issue, current_user)
+ email.deliver_later
+ email
+ end
+ end
+
protected
# Get project users with WATCH notification level