summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2018-10-10 17:13:09 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2018-10-10 17:13:09 +0000
commit0c78056a69cc3bee7fb1cd3261046995db55bfdf (patch)
tree67883c68edad43b2e6f96e9ea8b864370a6b207c /app/controllers
parent5533eeff239e024539f3ddd5b2ffe3528144beef (diff)
downloadredmine-0c78056a69cc3bee7fb1cd3261046995db55bfdf.tar.gz
redmine-0c78056a69cc3bee7fb1cd3261046995db55bfdf.zip
Send emails asynchronously (#26791).
Custom async_* delivery methods are removed in favor of ActiveJob (Async by default). git-svn-id: http://svn.redmine.org/redmine/trunk@17588 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/account_controller.rb8
-rw-r--r--app/controllers/admin_controller.rb6
-rw-r--r--app/controllers/documents_controller.rb2
-rw-r--r--app/controllers/files_controller.rb2
-rw-r--r--app/controllers/my_controller.rb2
-rw-r--r--app/controllers/users_controller.rb6
6 files changed, 11 insertions, 15 deletions
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index 5070295d2..7bb644761 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -87,7 +87,7 @@ class AccountController < ApplicationController
@user.must_change_passwd = false
if @user.save
@token.destroy
- Mailer.password_updated(@user, { remote_ip: request.remote_ip })
+ Mailer.deliver_password_updated(@user, User.current)
flash[:notice] = l(:notice_account_password_updated)
redirect_to signin_path
return
@@ -119,7 +119,7 @@ class AccountController < ApplicationController
if token.save
# Don't use the param to send the email
recipent = user.mails.detect {|e| email.casecmp(e) == 0} || user.mail
- Mailer.lost_password(token, recipent).deliver
+ Mailer.deliver_lost_password(user, token, recipent)
flash[:notice] = l(:notice_account_lost_email_sent)
redirect_to signin_path
return
@@ -313,7 +313,7 @@ class AccountController < ApplicationController
def register_by_email_activation(user, &block)
token = Token.new(:user => user, :action => "register")
if user.save and token.save
- Mailer.register(token).deliver
+ Mailer.deliver_register(user, token)
flash[:notice] = l(:notice_account_register_done, :email => ERB::Util.h(user.mail))
redirect_to signin_path
else
@@ -343,7 +343,7 @@ class AccountController < ApplicationController
def register_manually_by_administrator(user, &block)
if user.save
# Sends an email to the administrators
- Mailer.account_activation_request(user).deliver
+ Mailer.deliver_account_activation_request(user)
account_pending(user)
else
yield if block_given?
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index dfc73c5ab..885c3a169 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -60,16 +60,12 @@ class AdminController < ApplicationController
end
def test_email
- raise_delivery_errors = ActionMailer::Base.raise_delivery_errors
- # Force ActionMailer to raise delivery errors so we can catch it
- ActionMailer::Base.raise_delivery_errors = true
begin
- @test = Mailer.test_email(User.current).deliver
+ Mailer.deliver_test_email(User.current)
flash[:notice] = l(:notice_email_sent, ERB::Util.h(User.current.mail))
rescue Exception => e
flash[:error] = l(:notice_email_error, ERB::Util.h(Redmine::CodesetUtil.replace_invalid_utf8(e.message.dup)))
end
- ActionMailer::Base.raise_delivery_errors = raise_delivery_errors
redirect_to settings_path(:tab => 'notifications')
end
diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb
index dbf0e88dc..00b6dd9f1 100644
--- a/app/controllers/documents_controller.rb
+++ b/app/controllers/documents_controller.rb
@@ -88,7 +88,7 @@ class DocumentsController < ApplicationController
render_attachment_warning_if_needed(@document)
if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
- Mailer.attachments_added(attachments[:files]).deliver
+ Mailer.deliver_attachments_added(attachments[:files])
end
redirect_to document_path(@document)
end
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 7c596657c..6aa55f8a6 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -55,7 +55,7 @@ class FilesController < ApplicationController
if attachments[:files].present?
if Setting.notified_events.include?('file_added')
- Mailer.attachments_added(attachments[:files]).deliver
+ Mailer.deliver_attachments_added(attachments[:files])
end
respond_to do |format|
format.html {
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb
index 0a1d40349..d2cc0c53c 100644
--- a/app/controllers/my_controller.rb
+++ b/app/controllers/my_controller.rb
@@ -96,7 +96,7 @@ class MyController < ApplicationController
if @user.save
# The session token was destroyed by the password change, generate a new one
session[:tk] = @user.generate_session_token
- Mailer.password_updated(@user)
+ Mailer.deliver_password_updated(@user, User.current)
flash[:notice] = l(:notice_account_password_updated)
redirect_to my_account_path
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index aed4cd83f..65dd9a470 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -101,7 +101,7 @@ class UsersController < ApplicationController
@user.pref.safe_attributes = params[:pref]
if @user.save
- Mailer.account_information(@user, @user.password).deliver if params[:send_information]
+ Mailer.deliver_account_information(@user, @user.password) if params[:send_information]
respond_to do |format|
format.html {
@@ -146,9 +146,9 @@ class UsersController < ApplicationController
@user.pref.save
if was_activated
- Mailer.account_activated(@user).deliver
+ Mailer.deliver_account_activated(@user)
elsif @user.active? && params[:send_information] && @user != User.current
- Mailer.account_information(@user, @user.password).deliver
+ Mailer.deliver_account_information(@user, @user.password)
end
respond_to do |format|