Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2017-03-23 23:20:43 +0300
committerFelipe Artur <felipefac@gmail.com>2017-04-07 00:31:44 +0300
commit81375834b0d9644bbb1bcff9adbd2007ed09b180 (patch)
treebeabc54256a17f6c45e7f11a4e12d761eda2a28f /app/mailers
parentdb0ffef89d3b859b2e011eca9a05c2f25cac29bb (diff)
add the service desk mailer
Diffstat (limited to 'app/mailers')
-rw-r--r--app/mailers/emails/ee/service_desk.rb35
-rw-r--r--app/mailers/notify.rb2
2 files changed, 37 insertions, 0 deletions
diff --git a/app/mailers/emails/ee/service_desk.rb b/app/mailers/emails/ee/service_desk.rb
new file mode 100644
index 00000000000..8499dbe704d
--- /dev/null
+++ b/app/mailers/emails/ee/service_desk.rb
@@ -0,0 +1,35 @@
+module Emails
+ module EE
+ module ServiceDesk
+ def service_desk_thank_you_email(issue_id)
+ setup_service_desk_mail(issue_id)
+
+ mail_new_thread(@issue, service_desk_options(@support_bot.id))
+ end
+
+ def service_desk_new_note_email(issue_id, note_id)
+ @note = Note.find(note_id)
+ setup_service_desk_mail(issue_id)
+ mail_answer_thread(@issue, service_desk_options(@note.author_id))
+ end
+
+ private
+
+ def setup_service_desk_mail(issue_id)
+ @issue = Issue.find(issue_id)
+ @project = @issue.project
+ @support_bot = User.support_bot
+
+ @sent_notification = SentNotification.record(@issue, @support_bot.id, reply_key)
+ end
+
+ def service_desk_options(author_id)
+ {
+ from: sender(author_id),
+ to: @issue.service_desk_reply_to,
+ subject: "Re: #{@issue.title} (##{@issue.iid})"
+ }
+ end
+ end
+ end
+end
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
index f3669acf16f..3453025562e 100644
--- a/app/mailers/notify.rb
+++ b/app/mailers/notify.rb
@@ -11,6 +11,8 @@ class Notify < BaseMailer
include Emails::Pipelines
include Emails::Members
+ include Emails::EE::ServiceDesk
+
helper MergeRequestsHelper
helper DiffHelper
helper BlobHelper