Another fix for emails
This commit is contained in:
parent
343a55deef
commit
bebdbefaba
@ -118,7 +118,7 @@ class ApplicationController < BaseController
|
||||
requestHash['env'][key.to_s] = value.to_s
|
||||
end
|
||||
|
||||
UserMailer.send_mail(:error_report,
|
||||
send_mail(:error_report,
|
||||
"A JavaScript error has occurred",
|
||||
report,
|
||||
params[:message],
|
||||
@ -193,7 +193,7 @@ class ApplicationController < BaseController
|
||||
request.env.each do | key, value |
|
||||
requestHash['env'][key.to_s] = value.to_s
|
||||
end
|
||||
UserMailer.send_mail(:error_report,
|
||||
send_mail(:error_report,
|
||||
"An error has occurred in #{Rails.env}",
|
||||
nil,
|
||||
exception.to_s,
|
||||
@ -234,7 +234,7 @@ class ApplicationController < BaseController
|
||||
end
|
||||
end
|
||||
|
||||
UserMailer.send_mail(:contact,
|
||||
send_mail(:contact,
|
||||
current_user || params[:email],
|
||||
params[:subject],
|
||||
params[:message],
|
||||
@ -242,7 +242,7 @@ class ApplicationController < BaseController
|
||||
)
|
||||
|
||||
request_info = session['request_info'] || { 'request' => request, 'params' => params }
|
||||
UserMailer.send_mail(:contact_details,
|
||||
send_mail(:contact_details,
|
||||
current_user || params[:email],
|
||||
params[:subject],
|
||||
params[:message],
|
||||
@ -323,7 +323,7 @@ class ApplicationController < BaseController
|
||||
object.get_translators(data, locale).each do |id, user|
|
||||
if user.id != current_user.id && user.id != translator_id
|
||||
LinguaFranca.with_locale user.locale do
|
||||
UserMailer.send_mail(:send, mailer, object.id, data, locale, user.id, translator.id)
|
||||
send_mail(:send, mailer, object.id, data, locale, user.id, translator.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -337,7 +337,7 @@ class ApplicationController < BaseController
|
||||
object.get_translators(data).each do |id, user|
|
||||
if user.id != current_user.id
|
||||
LinguaFranca.with_locale user.locale do
|
||||
UserMailer.send_mail(:send, mailer, object.id, data, user.id, current_user.id)
|
||||
send_mail(:send, mailer, object.id, data, user.id, current_user.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -360,7 +360,7 @@ class ApplicationController < BaseController
|
||||
request.env.each do | key, value |
|
||||
requestHash['env'][key.to_s] = value.to_s
|
||||
end
|
||||
UserMailer.send_mail(:error_report,
|
||||
send_mail(:error_report,
|
||||
"A missing translation found in #{Rails.env}",
|
||||
"<p>A translation for <code>#{key}</code> in <code>#{locale.to_s}</code> was found. The text that was rendered to the user was:</p><blockquote>#{str || 'nil'}</blockquote>",
|
||||
exception.to_s,
|
||||
@ -636,6 +636,14 @@ class ApplicationController < BaseController
|
||||
|
||||
# send the confirmation email and make sure it get sent as quickly as possible
|
||||
def send_confirmation(confirmation)
|
||||
UserMailer.send_mail(:email_confirmation, confirmation.id)
|
||||
send_mail(:email_confirmation, confirmation.id)
|
||||
end
|
||||
|
||||
def send_mail(*args)
|
||||
if Rails.env.preview? || Rails.env.production?
|
||||
UserMailer.delay(queue: Rails.env.to_s).send(*args)
|
||||
else
|
||||
UserMailer.send(*args).deliver_now
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1015,7 +1015,7 @@ class ConferenceAdministrationController < ApplicationController
|
||||
@register_template = :administration
|
||||
if params[:button] == 'send'
|
||||
view_context.broadcast_to(@send_to).each do |user|
|
||||
UserMailer.send_mail(:broadcast,
|
||||
send_mail(:broadcast,
|
||||
"#{request.protocol}#{request.host_with_port}",
|
||||
@subject,
|
||||
@body,
|
||||
@ -1030,7 +1030,7 @@ class ConferenceAdministrationController < ApplicationController
|
||||
@broadcast_step = :preview
|
||||
elsif params[:button] == 'test'
|
||||
@broadcast_step = :test
|
||||
UserMailer.send_mail(:broadcast,
|
||||
send_mail(:broadcast,
|
||||
"#{request.protocol}#{request.host_with_port}",
|
||||
@subject,
|
||||
@body,
|
||||
|
@ -217,7 +217,7 @@ class WorkshopsController < ApplicationController
|
||||
# create the request by making the user a facilitator but making their role 'requested'
|
||||
WorkshopFacilitator.create(user_id: current_user.id, workshop_id: workshop.id, role: :requested)
|
||||
|
||||
UserMailer.send_mail(:workshop_facilitator_request, workshop.id, current_user.id, params[:message])
|
||||
send_mail(:workshop_facilitator_request, workshop.id, current_user.id, params[:message])
|
||||
|
||||
redirect_to sent_facilitate_workshop_url(@this_conference.slug, workshop.id)
|
||||
end
|
||||
@ -251,7 +251,7 @@ class WorkshopsController < ApplicationController
|
||||
f.role = :collaborator
|
||||
f.save
|
||||
LinguaFranca.with_locale(user.locale) do
|
||||
UserMailer.send_mail(:workshop_facilitator_request_approved, workshop.id, user.id)
|
||||
send_mail(:workshop_facilitator_request_approved, workshop.id, user.id)
|
||||
end
|
||||
return redirect_to view_workshop_url(@this_conference.slug, workshop.id)
|
||||
end
|
||||
@ -261,7 +261,7 @@ class WorkshopsController < ApplicationController
|
||||
:workshop_id => workshop.id,
|
||||
:user_id => user_id)
|
||||
LinguaFranca.with_locale user.locale do
|
||||
UserMailer.send_mail(:workshop_facilitator_request_denied, workshop.id, user.id)
|
||||
send_mail(:workshop_facilitator_request_denied, workshop.id, user.id)
|
||||
end
|
||||
return redirect_to view_workshop_url(@this_conference.slug, workshop.id)
|
||||
end
|
||||
@ -309,7 +309,7 @@ class WorkshopsController < ApplicationController
|
||||
WorkshopFacilitator.create(user_id: user.id, workshop_id: workshop.id, role: :collaborator)
|
||||
|
||||
LinguaFranca.with_locale user.locale do
|
||||
UserMailer.send_mail(:workshop_facilitator_request_approved, workshop.id, user.id)
|
||||
send_mail(:workshop_facilitator_request_approved, workshop.id, user.id)
|
||||
end
|
||||
end
|
||||
|
||||
@ -329,7 +329,7 @@ class WorkshopsController < ApplicationController
|
||||
|
||||
unless comment.user.id == current_user.id
|
||||
LinguaFranca.with_locale comment.user.locale do
|
||||
UserMailer.send_mail(:workshop_comment, workshop.id, new_comment.id, comment.user.id)
|
||||
send_mail(:workshop_comment, workshop.id, new_comment.id, comment.user.id)
|
||||
end
|
||||
end
|
||||
elsif params[:button] = 'add_comment'
|
||||
@ -338,7 +338,7 @@ class WorkshopsController < ApplicationController
|
||||
workshop.active_facilitators.each do | u |
|
||||
unless u.id == current_user.id
|
||||
LinguaFranca.with_locale u.locale do
|
||||
UserMailer.send_mail(:workshop_comment, workshop.id, new_comment.id, u.id)
|
||||
send_mail(:workshop_comment, workshop.id, new_comment.id, u.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -167,14 +167,6 @@ class UserMailer < ActionMailer::Base
|
||||
mail to: 'goodgodwin@hotmail.com', subject: @subject
|
||||
end
|
||||
|
||||
def self.send_mail(*args)
|
||||
if Rails.env.preview? || Rails.env.production?
|
||||
delay(queue: Rails.env.to_s).send(*args)
|
||||
else
|
||||
send(*args).deliver_now
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def set_host(*args)
|
||||
if Rails.env.production?
|
||||
|
Loading…
x
Reference in New Issue
Block a user