Browse Source

Switched to immediate email delivery

development
Godwin 7 years ago
parent
commit
df748ee8be
  1. 22
      app/controllers/application_controller.rb
  2. 2
      app/controllers/conference_administration_controller.rb

22
app/controllers/application_controller.rb

@ -215,12 +215,10 @@ class ApplicationController < BaseController
def contact_send def contact_send
email_list = ['Godwin <goodgodwin@hotmail.com>'] email_list = ['Godwin <goodgodwin@hotmail.com>']
if params[:reason] == 'conference' if params[:reason] == 'conference' && logged_in?
@conference.organizations.each do |org| @conference.conference_administrators.each do |user|
org.users.each do |user| email_list << user.named_email
# email_list << user.named_email
end
end end
end end
@ -234,14 +232,14 @@ class ApplicationController < BaseController
request_info['env'][key.to_s] = value.to_s request_info['env'][key.to_s] = value.to_s
end end
send_mail(:contact, send_delayed_mail(:contact,
current_user || params[:email], current_user || params[:email],
params[:subject], params[:subject],
params[:message], params[:message],
email_list email_list
) )
send_mail(:contact_details, send_delayed_mail(:contact_details,
current_user || params[:email], current_user || params[:email],
params[:subject], params[:subject],
params[:message], params[:message],
@ -326,7 +324,7 @@ class ApplicationController < BaseController
object.get_translators(data, locale).each do |id, user| object.get_translators(data, locale).each do |id, user|
if user.id != current_user.id && user.id != translator_id if user.id != current_user.id && user.id != translator_id
LinguaFranca.with_locale user.locale do LinguaFranca.with_locale user.locale do
send_mail(:send, mailer, object.id, data, locale, user.id, translator.id) send_delayed_mail(:send, mailer, object.id, data, locale, user.id, translator.id)
end end
end end
end end
@ -340,7 +338,7 @@ class ApplicationController < BaseController
object.get_translators(data).each do |id, user| object.get_translators(data).each do |id, user|
if user.id != current_user.id if user.id != current_user.id
LinguaFranca.with_locale user.locale do LinguaFranca.with_locale user.locale do
send_mail(:send, mailer, object.id, data, user.id, current_user.id) send_delayed_mail(:send, mailer, object.id, data, user.id, current_user.id)
end end
end end
end end
@ -614,7 +612,7 @@ class ApplicationController < BaseController
send_mail(:email_confirmation, confirmation.id) send_mail(:email_confirmation, confirmation.id)
end end
def send_mail(*args) def send_delayed_mail(*args)
if Rails.env.preview? || Rails.env.production? if Rails.env.preview? || Rails.env.production?
UserMailer.delay(queue: Rails.env.to_s).send(*args) UserMailer.delay(queue: Rails.env.to_s).send(*args)
else else
@ -622,6 +620,10 @@ class ApplicationController < BaseController
end end
end end
def send_mail(*args)
UserMailer.send(*args).deliver_now
end
def policies def policies
[ [
:commitment, :commitment,

2
app/controllers/conference_administration_controller.rb

@ -1359,7 +1359,7 @@ class ConferenceAdministrationController < ApplicationController
@register_template = :administration @register_template = :administration
if params[:button] == 'send' if params[:button] == 'send'
view_context.broadcast_to(@send_to).each do |user| view_context.broadcast_to(@send_to).each do |user|
send_mail(:broadcast, send_delayed_mail(:broadcast,
"#{request.protocol}#{request.host_with_port}", "#{request.protocol}#{request.host_with_port}",
@subject, @subject,
@body, @body,

Loading…
Cancel
Save