aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/foi_attachment.rb3
-rw-r--r--app/models/request_mailer.rb26
-rw-r--r--app/models/track_mailer.rb2
-rw-r--r--app/models/track_thing.rb2
4 files changed, 17 insertions, 16 deletions
diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb
index 723bc4abb..bba0b6a8d 100644
--- a/app/models/foi_attachment.rb
+++ b/app/models/foi_attachment.rb
@@ -317,8 +317,7 @@ class FoiAttachment < ActiveRecord::Base
text = CGI.escapeHTML(text)
text = MySociety::Format.make_clickable(text)
html = text.gsub(/\n/, '<br>')
- return '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd"><html><head><title></title></head><body>' + html + "</body></html>", wrapper_id
+ return '<!DOCTYPE html><html><head><title></title></head><body>' + html + "</body></html>", wrapper_id
end
# the extractions will also produce image files, which go in the
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb
index e2212a0ac..955f73ef4 100644
--- a/app/models/request_mailer.rb
+++ b/app/models/request_mailer.rb
@@ -67,8 +67,8 @@ class RequestMailer < ApplicationMailer
@from = user.name_and_email
@recipients = contact_from_name_and_email
@subject = _("FOI response requires admin ({{reason}}) - {{title}}", :reason => info_request.described_state, :title => info_request.title)
- url = main_url(request_url(info_request))
- admin_url = request_admin_url(info_request)
+ url = request_url(info_request)
+ admin_url = admin_request_show_url(info_request)
@body = {:reported_by => user, :message => message, :info_request => info_request, :url => url, :admin_url => admin_url }
end
@@ -76,14 +76,14 @@ class RequestMailer < ApplicationMailer
def new_response(info_request, incoming_message)
# Don't use login link here, just send actual URL. This is
# because people tend to forward these emails amongst themselves.
- url = main_url(incoming_message_url(incoming_message))
+ url = incoming_message_url(incoming_message)
@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
'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).html_safe
@body = { :incoming_message => incoming_message, :info_request => info_request, :url => url }
end
@@ -102,7 +102,7 @@ class RequestMailer < ApplicationMailer
'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).html_safe
@body = { :info_request => info_request, :url => url }
end
@@ -121,7 +121,7 @@ class RequestMailer < ApplicationMailer
'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).html_safe
@body = { :info_request => info_request, :url => url }
end
@@ -131,7 +131,7 @@ class RequestMailer < ApplicationMailer
# Make a link going to the form to describe state, and which logs the
# user in.
post_redirect = PostRedirect.new(
- :uri => main_url(request_url(info_request)) + "#describe_state_form_1",
+ :uri => request_url(info_request) + "#describe_state_form_1",
:user_id => info_request.user.id)
post_redirect.save!
url = confirm_url(:email_token => post_redirect.email_token)
@@ -153,7 +153,7 @@ class RequestMailer < ApplicationMailer
'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))
+ url = request_url(info_request)
@body = {:info_request => info_request, :url => url}
end
@@ -173,7 +173,7 @@ class RequestMailer < ApplicationMailer
'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
+ @subject = (_("Clarify your FOI request - ") + info_request.title).html_safe
@body = { :incoming_message => incoming_message, :info_request => info_request, :url => url }
end
@@ -184,8 +184,8 @@ class RequestMailer < ApplicationMailer
'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
- @body = { :comment => comment, :info_request => info_request, :url => main_url(comment_url(comment)) }
+ @subject = (_("Somebody added a note to your FOI request - ") + info_request.title).html_safe
+ @body = { :comment => comment, :info_request => info_request, :url => comment_url(comment) }
end
def comment_on_alert_plural(info_request, count, earliest_unalerted_comment)
@from = contact_from_name_and_email
@@ -193,8 +193,8 @@ class RequestMailer < ApplicationMailer
'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
- @body = { :count => count, :info_request => info_request, :url => main_url(comment_url(earliest_unalerted_comment)) }
+ @subject = (_("Some notes have been added to your FOI request - ") + info_request.title).html_safe
+ @body = { :count => count, :info_request => info_request, :url => comment_url(earliest_unalerted_comment) }
end
# Class function, called by script/mailin with all incoming responses.
diff --git a/app/models/track_mailer.rb b/app/models/track_mailer.rb
index 7dfa87f52..51440e4d7 100644
--- a/app/models/track_mailer.rb
+++ b/app/models/track_mailer.rb
@@ -7,7 +7,7 @@
class TrackMailer < ApplicationMailer
def event_digest(user, email_about_things)
post_redirect = PostRedirect.new(
- :uri => main_url(user_url(user)) + "#email_subscriptions",
+ :uri => user_url(user) + "#email_subscriptions",
:user_id => user.id)
post_redirect.save!
unsubscribe_url = confirm_url(:email_token => post_redirect.email_token)
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index dfe92b7fe..a0c74bdb6 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -23,6 +23,8 @@
require 'set'
+# TODO: TrackThing looks like a good candidate for single table inheritance
+
class TrackThing < ActiveRecord::Base
belongs_to :tracking_user, :class_name => 'User'
validates_presence_of :track_query