aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/request_mailer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/request_mailer.rb')
-rw-r--r--app/models/request_mailer.rb48
1 files changed, 28 insertions, 20 deletions
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb
index fc317d20d..75dc58447 100644
--- a/app/models/request_mailer.rb
+++ b/app/models/request_mailer.rb
@@ -47,7 +47,7 @@ class RequestMailer < ApplicationMailer
def requires_admin(info_request)
@from = info_request.user.name_and_email
@recipients = contact_from_name_and_email
- @subject = "FOI response requires admin - " + info_request.title
+ @subject = _("FOI response requires admin - ") + info_request.title
url = main_url(request_url(info_request))
admin_url = request_admin_url(info_request)
@body = {:info_request => info_request, :url => url, :admin_url => admin_url }
@@ -61,9 +61,10 @@ class RequestMailer < ApplicationMailer
@from = contact_from_name_and_email
headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
- 'Auto-Submitted' => 'auto-generated' # http://tools.ietf.org/html/rfc3834
+ 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
+ 'X-Auto-Response-Suppress' => 'OOF'
@recipients = info_request.user.name_and_email
- @subject = "New response to your FOI request - " + info_request.title
+ @subject = _("New response to your FOI request - ") + info_request.title
@body = { :incoming_message => incoming_message, :info_request => info_request, :url => url }
end
@@ -79,9 +80,10 @@ class RequestMailer < ApplicationMailer
@from = contact_from_name_and_email
headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
- 'Auto-Submitted' => 'auto-generated' # http://tools.ietf.org/html/rfc3834
+ 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
+ 'X-Auto-Response-Suppress' => 'OOF'
@recipients = user.name_and_email
- @subject = "Delayed response to your FOI request - " + info_request.title
+ @subject = _("Delayed response to your FOI request - ") + info_request.title
@body = { :info_request => info_request, :url => url }
end
@@ -97,9 +99,10 @@ class RequestMailer < ApplicationMailer
@from = contact_from_name_and_email
headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
- 'Auto-Submitted' => 'auto-generated' # http://tools.ietf.org/html/rfc3834
+ 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
+ 'X-Auto-Response-Suppress' => 'OOF'
@recipients = user.name_and_email
- @subject = "You're long overdue a response to your FOI request - " + info_request.title
+ @subject = _("You're long overdue a response to your FOI request - ") + info_request.title
@body = { :info_request => info_request, :url => url }
end
@@ -116,9 +119,10 @@ class RequestMailer < ApplicationMailer
@from = contact_from_name_and_email
headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
- 'Auto-Submitted' => 'auto-generated' # http://tools.ietf.org/html/rfc3834
+ 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
+ 'X-Auto-Response-Suppress' => 'OOF'
@recipients = info_request.user.name_and_email
- @subject = "Was the response you got to your FOI request any good?"
+ @subject = _("Was the response you got to your FOI request any good?")
@body = { :incoming_message => incoming_message, :info_request => info_request, :url => url }
end
@@ -126,7 +130,8 @@ class RequestMailer < ApplicationMailer
def old_unclassified_updated(info_request)
@from = contact_from_name_and_email
headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
- 'Auto-Submitted' => 'auto-generated' # http://tools.ietf.org/html/rfc3834
+ 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
+ 'X-Auto-Response-Suppress' => 'OOF'
@recipients = info_request.user.name_and_email
@subject = "Someone has updated the status of your request"
url = main_url(request_url(info_request))
@@ -146,7 +151,8 @@ class RequestMailer < ApplicationMailer
@from = contact_from_name_and_email
headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
- 'Auto-Submitted' => 'auto-generated' # http://tools.ietf.org/html/rfc3834
+ 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
+ 'X-Auto-Response-Suppress' => 'OOF'
@recipients = info_request.user.name_and_email
@subject = "Clarify your FOI request - " + info_request.title
@body = { :incoming_message => incoming_message, :info_request => info_request, :url => url }
@@ -156,17 +162,19 @@ class RequestMailer < ApplicationMailer
def comment_on_alert(info_request, comment)
@from = contact_from_name_and_email
headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
- 'Auto-Submitted' => 'auto-generated' # http://tools.ietf.org/html/rfc3834
+ 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
+ 'X-Auto-Response-Suppress' => 'OOF'
@recipients = info_request.user.name_and_email
- @subject = "Somebody added a note to your FOI request - " + info_request.title
+ @subject = _("Somebody added a note to your FOI request - ") + info_request.title
@body = { :comment => comment, :info_request => info_request, :url => main_url(comment_url(comment)) }
end
def comment_on_alert_plural(info_request, count, earliest_unalerted_comment)
@from = contact_from_name_and_email
headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken
- 'Auto-Submitted' => 'auto-generated' # http://tools.ietf.org/html/rfc3834
+ 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
+ 'X-Auto-Response-Suppress' => 'OOF'
@recipients = info_request.user.name_and_email
- @subject = "Some notes have been added to your FOI request - " + info_request.title
+ @subject = _("Some notes have been added to your FOI request - ") + info_request.title
@body = { :count => count, :info_request => info_request, :url => main_url(comment_url(earliest_unalerted_comment)) }
end
@@ -266,12 +274,12 @@ class RequestMailer < ApplicationMailer
end
end
- # Send email alerts for new responses which haven't been classified. Goes
- # out 3 days after last update of event, then after 7, then after 24.
+ # Send email alerts for new responses which haven't been classified. By default,
+ # it goes out 3 days after last update of event, then after 10, then after 24.
def self.alert_new_response_reminders
- self.alert_new_response_reminders_internal(3, 'new_response_reminder_1')
- self.alert_new_response_reminders_internal(10, 'new_response_reminder_2')
- self.alert_new_response_reminders_internal(24, 'new_response_reminder_3')
+ MySociety::Config.get("NEW_RESPONSE_REMINDER_AFTER_DAYS", [3, 10, 24]).each_with_index do |days, i|
+ self.alert_new_response_reminders_internal(days, "new_response_reminder_#{i+1}")
+ end
end
def self.alert_new_response_reminders_internal(days_since, type_code)
info_requests = InfoRequest.find_old_unclassified(:order => 'info_requests.id',