aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin_request_controller.rb9
-rw-r--r--app/controllers/application_controller.rb11
-rw-r--r--app/controllers/general_controller.rb6
-rw-r--r--app/helpers/application_helper.rb26
-rw-r--r--app/models/incoming_message.rb79
-rw-r--r--app/models/info_request.rb22
-rw-r--r--app/models/info_request_event.rb2
-rw-r--r--app/models/outgoing_mailer.rb5
-rw-r--r--app/models/raw_email.rb4
-rw-r--r--app/models/request_mailer.rb7
-rw-r--r--app/models/user.rb2
-rw-r--r--app/views/comment/_single_comment.rhtml2
-rw-r--r--app/views/help/api.rhtml2
-rw-r--r--app/views/layouts/default.rhtml8
-rw-r--r--app/views/request/_correspondence.rhtml24
-rw-r--r--app/views/request/select_authority.rhtml4
-rw-r--r--app/views/request/show.rhtml4
-rw-r--r--app/views/user/_show_user_info.rhtml2
-rw-r--r--app/views/user/sign.rhtml17
19 files changed, 109 insertions, 127 deletions
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index 3e574b10f..1de63be59 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.rb
@@ -207,8 +207,7 @@ class AdminRequestController < AdminController
end
raw_email_data = incoming_message.raw_email.data
- mail = TMail::Mail.parse(raw_email_data)
- mail.base64_decode
+ mail = MailHandler.mail_from_raw_email(raw_email_data)
destination_request.receive(mail, raw_email_data, true)
incoming_message_id = incoming_message.id
@@ -278,7 +277,7 @@ class AdminRequestController < AdminController
if params[:incoming_message_id]
incoming_message = IncomingMessage.find(params[:incoming_message_id])
- email = incoming_message.mail.from_addrs[0].address
+ email = incoming_message.from_address
name = incoming_message.safe_mail_from || info_request.public_body.name
else
email = info_request.public_body.request_email
@@ -313,12 +312,12 @@ class AdminRequestController < AdminController
@raw_email = RawEmail.find(params[:id])
# For the holding pen, try to guess where it should be ...
@holding_pen = false
- if (@raw_email.incoming_message.info_request == InfoRequest.holding_pen_request && !@raw_email.incoming_message.mail.from_addrs.nil? && @raw_email.incoming_message.mail.from_addrs.size > 0)
+ if (@raw_email.incoming_message.info_request == InfoRequest.holding_pen_request && !@raw_email.incoming_message.empty_from_field?)
@holding_pen = true
# 1. Use domain of email to try and guess which public body it
# is associated with, so we can display that.
- email = @raw_email.incoming_message.mail.from_addrs[0].spec
+ email = @raw_email.incoming_message.from_email
domain = PublicBody.extract_domain_from_email(email)
if domain.nil?
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index b707ae878..3c94e1b47 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -117,17 +117,14 @@ class ApplicationController < ActionController::Base
# Override default error handler, for production sites.
def rescue_action_in_public(exception)
- # Call `set_view_paths` from the theme, if it exists.
+ # Looks for before_filters called something like `set_view_paths_{themename}`. These
+ # are set by the themes.
# Normally, this is called by the theme itself in a
# :before_filter, but when there's an error, this doesn't
# happen. By calling it here, we can ensure error pages are
# still styled according to the theme.
- begin
- set_view_paths
- rescue NameError => e
- if !(e.message =~ /undefined local variable or method `set_view_paths'/)
- raise
- end
+ ActionController::Base.before_filters.select{|f| f.to_s =~ /set_view_paths/}.each do |f|
+ self.send(f)
end
# Make sure expiry time for session is set (before_filters are
# otherwise missed by this override)
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 0cde238cd..3ba636e29 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -226,12 +226,6 @@ class GeneralController < ApplicationController
redirect_to request_url(info_request)
end
- # For debugging
- def fai_test
- sleep 10
- render :text => "awake\n"
- end
-
def custom_css
long_cache
@locale = self.locale_from_params()
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ab953cb25..6411cf27e 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -77,25 +77,6 @@ module ApplicationHelper
return LanguageNames::get_language_name(locale)
end
- # Use our own algorithm for finding path of cache
- def foi_cache(name = {}, options = nil, &block)
- if @controller.perform_caching
- key = name.merge(:only_path => true)
- key_path = @controller.foi_fragment_cache_path(key)
-
- if @controller.foi_fragment_cache_exists?(key_path)
- cached = @controller.foi_fragment_cache_read(key_path)
- output_buffer.concat(cached)
- return
- end
-
- pos = output_buffer.length
- content = block.call
- @controller.foi_fragment_cache_write(key_path, output_buffer[pos..-1])
- else
- block.call
- end
- end
# (unfortunately) ugly way of getting id of generated form element
# ids
# see http://chrisblunt.com/2009/10/12/rails-getting-the-id-of-form-fields-inside-a-fields_for-block/
@@ -131,5 +112,12 @@ module ApplicationHelper
return "#{exact_date} (#{ago_text})"
end
+ # Note that if the admin interface is proxied via another server, we can't
+ # rely on a sesssion being shared between the front end and admin interface,
+ # so need to check the status of the user.
+ def is_admin?
+ return !session[:using_admin].nil? || (!@user.nil? && @user.super?)
+ end
+
end
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 60828e179..123319125 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -38,14 +38,6 @@ require 'zip/zip'
require 'mapi/msg'
require 'mapi/convert'
-# Monkeypatch! Adding some extra members to store extra info in.
-module TMail
- class Mail
- attr_accessor :url_part_number
- attr_accessor :rfc822_attachment # when a whole email message is attached as text
- attr_accessor :within_rfc822_attachment # for parts within a message attached as text (for getting subject mainly)
- end
-end
class IncomingMessage < ActiveRecord::Base
belongs_to :info_request
@@ -70,21 +62,36 @@ class IncomingMessage < ActiveRecord::Base
'application/zip' => 1,
}
- # Return the structured TMail::Mail object
- # Documentation at http://i.loveruby.net/en/projects/tmail/doc/
+ # Return a cached structured mail object
def mail(force = nil)
if (!force.nil? || @mail.nil?) && !self.raw_email.nil?
- # Hack round bug in TMail's MIME decoding.
- # Report of TMail bug:
- # http://rubyforge.org/tracker/index.php?func=detail&aid=21810&group_id=4512&atid=17370
- copy_of_raw_data = self.raw_email.data.gsub(/; boundary=\s+"/im,'; boundary="')
-
- @mail = TMail::Mail.parse(copy_of_raw_data)
- @mail.base64_decode
+ @mail = MailHandler.mail_from_raw_email(self.raw_email.data)
end
@mail
end
+ def from_address
+ self.mail.from_addrs[0].address
+ end
+
+ def empty_from_field?
+ self.mail.from_addrs.nil? || self.mail.from_addrs.size == 0
+ end
+
+ def from_email
+ self.mail.from_addrs[0].spec
+ end
+
+ def addresses
+ ((self.mail.to || []) +
+ (self.mail.cc || []) +
+ (self.mail.envelope_to || [])).uniq
+ end
+
+ def message_id
+ self.mail.message_id
+ end
+
# Returns the name of the person the incoming message is from, or nil if
# there isn't one or if there is only an email address. XXX can probably
# remove from_name_if_present (which is a monkey patch) by just calling
@@ -93,10 +100,10 @@ class IncomingMessage < ActiveRecord::Base
# Return false if for some reason this is a message that we shouldn't let them reply to
def _calculate_valid_to_reply_to
# check validity of email
- if self.mail.from_addrs.nil? || self.mail.from_addrs.size == 0
+ if empty_from_field?
return false
end
- email = self.mail.from_addrs[0].spec
+ email = self.from_email
if !MySociety::Validate.is_valid_email(email)
return false
end
@@ -136,7 +143,7 @@ class IncomingMessage < ActiveRecord::Base
# instead?
self.mail_from = self.mail.from_name_if_present
begin
- self.mail_from_domain = PublicBody.extract_domain_from_email(self.mail.from_addrs[0].spec)
+ self.mail_from_domain = PublicBody.extract_domain_from_email(self.from_email)
rescue NoMethodError
self.mail_from_domain = ""
end
@@ -185,9 +192,9 @@ class IncomingMessage < ActiveRecord::Base
# Number the attachments in depth first tree order, for use in URLs.
# XXX This fills in part.rfc822_attachment and part.url_part_number within
- # all the parts of the email (see TMail monkeypatch above for how these
- # attributes are added). ensure_parts_counted must be called before using
- # the attributes.
+ # all the parts of the email (see monkeypatches in lib/mail_handler/tmail_extensions and
+ # lib/mail_handler/mail_extensions for how these attributes are added). ensure_parts_counted
+ # must be called before using the attributes.
def ensure_parts_counted
@count_parts_count = 0
_count_parts_recursive(self.mail)
@@ -200,20 +207,20 @@ class IncomingMessage < ActiveRecord::Base
_count_parts_recursive(p)
end
else
- part_filename = TMail::Mail.get_part_file_name(part)
+ part_filename = MailHandler.get_part_file_name(part)
begin
if part.content_type == 'message/rfc822'
# An email attached as text
# e.g. http://www.whatdotheyknow.com/request/64/response/102
- part.rfc822_attachment = TMail::Mail.parse(part.body)
+ part.rfc822_attachment = MailHandler.mail_from_raw_email(part.body, decode=false)
elsif part.content_type == 'application/vnd.ms-outlook' || part_filename && AlaveteliFileTypes.filename_to_mimetype(part_filename) == 'application/vnd.ms-outlook'
# An email attached as an Outlook file
# e.g. http://www.whatdotheyknow.com/request/chinese_names_for_british_politi
msg = Mapi::Msg.open(StringIO.new(part.body))
- part.rfc822_attachment = TMail::Mail.parse(msg.to_mime.to_s)
+ part.rfc822_attachment = MailHandler.mail_from_raw_email(msg.to_mime.to_s, decode=false)
elsif part.content_type == 'application/ms-tnef'
# A set of attachments in a TNEF file
- part.rfc822_attachment = TNEF.as_tmail(part.body)
+ part.rfc822_attachment = MailHandler.mail_from_tnef(part.body)
end
rescue
# If attached mail doesn't parse, treat it as text part
@@ -451,16 +458,6 @@ class IncomingMessage < ActiveRecord::Base
return text
end
- # Internal function
- def _get_part_file_name(mail)
- part_file_name = TMail::Mail.get_part_file_name(mail)
- if part_file_name.nil?
- return nil
- end
- part_file_name = part_file_name.dup
- return part_file_name
- end
-
# (This risks losing info if the unchosen alternative is the only one to contain
# useful info, but let's worry about that another time)
def get_attachment_leaves
@@ -512,7 +509,7 @@ class IncomingMessage < ActiveRecord::Base
end
# PDFs often come with this mime type, fix it up for view code
if curr_mail.content_type == 'application/octet-stream'
- part_file_name = self._get_part_file_name(curr_mail)
+ part_file_name = MailHandler.get_part_file_name(curr_mail)
calc_mime = AlaveteliFileTypes.filename_and_content_to_mimetype(part_file_name, curr_mail.body)
if calc_mime
curr_mail.content_type = calc_mime
@@ -792,7 +789,7 @@ class IncomingMessage < ActiveRecord::Base
attachment = self.foi_attachments.find_or_create_by_hexdigest(:hexdigest => hexdigest)
attachment.update_attributes(:url_part_number => leaf.url_part_number,
:content_type => leaf.content_type,
- :filename => _get_part_file_name(leaf),
+ :filename => MailHandler.get_part_file_name(leaf),
:charset => leaf.charset,
:within_rfc822_subject => within_rfc822_subject,
:body => body)
@@ -1062,10 +1059,10 @@ class IncomingMessage < ActiveRecord::Base
# Return false if for some reason this is a message that we shouldn't let them reply to
def valid_to_reply_to?
# check validity of email
- if self.mail.from_addrs.nil? || self.mail.from_addrs.size == 0
+ if empty_from_field?
return false
end
- email = self.mail.from_addrs[0].spec
+ email = self.from_email
if !MySociety::Validate.is_valid_email(email)
return false
end
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 89893a396..194f8e105 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -275,7 +275,7 @@ public
return self.magic_email("request-")
end
def incoming_name_and_email
- return TMail::Address.address_from_name_and_email(self.user_name, self.incoming_email).to_s
+ return MailHandler.address_from_name_and_email(self.user_name, self.incoming_email)
end
# Subject lines for emails about the request
@@ -355,12 +355,7 @@ public
def InfoRequest.guess_by_incoming_email(incoming_message)
guesses = []
# 1. Try to guess based on the email address(es)
- addresses =
- (incoming_message.mail.to || []) +
- (incoming_message.mail.cc || []) +
- (incoming_message.mail.envelope_to || [])
- addresses.uniq!
- for address in addresses
+ incoming_message.addresses.each do |address|
id, hash = InfoRequest._extract_id_hash_from_email(address)
guesses.push(InfoRequest.find_by_id(id))
guesses.push(InfoRequest.find_by_idhash(hash))
@@ -419,8 +414,7 @@ public
end
for im in self.incoming_messages
- other_message_id = im.mail.message_id
- if message_id == other_message_id
+ if message_id == im.message_id
return true
end
end
@@ -713,11 +707,11 @@ public
return self.public_body.is_followupable?
end
def recipient_name_and_email
- return TMail::Address.address_from_name_and_email(
+ return MailHandler.address_from_name_and_email(
_("{{law_used}} requests at {{public_body}}",
:law_used => self.law_used_short,
:public_body => self.public_body.short_or_long_name),
- self.recipient_email).to_s
+ self.recipient_email)
end
# History of some things that have happened
@@ -1130,7 +1124,11 @@ public
}
if deep
- ret[:user] = self.user.json_for_api
+ if self.user
+ ret[:user] = self.user.json_for_api
+ else
+ ret[:user_name] = self.user_name
+ end
ret[:public_body] = self.public_body.json_for_api
ret[:info_request_events] = self.info_request_events.map { |e| e.json_for_api(false) }
end
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 5a8e3416f..09eba31ab 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -384,7 +384,7 @@ class InfoRequestEvent < ActiveRecord::Base
if prev_addr.nil? || curr_addr.nil?
return false
end
- return TMail::Address.parse(prev_addr).address == TMail::Address.parse(curr_addr).address
+ return MailHandler.address_from_string(prev_addr) == MailHandler.address_from_string(curr_addr)
end
def json_for_api(deep, snippet_highlight_proc = nil)
diff --git a/app/models/outgoing_mailer.rb b/app/models/outgoing_mailer.rb
index a307bb778..503166b8a 100644
--- a/app/models/outgoing_mailer.rb
+++ b/app/models/outgoing_mailer.rb
@@ -47,7 +47,8 @@ class OutgoingMailer < ApplicationMailer
return info_request.recipient_name_and_email
else
# calling safe_mail_from from so censor rules are run
- return TMail::Address.address_from_name_and_email(incoming_message_followup.safe_mail_from, incoming_message_followup.mail.from_addrs[0].spec).to_s
+ return MailHandler.address_from_name_and_email(incoming_message_followup.safe_mail_from,
+ incoming_message_followup.from_email)
end
end
# Used in the preview of followup
@@ -64,7 +65,7 @@ class OutgoingMailer < ApplicationMailer
if incoming_message_followup.nil? || !incoming_message_followup.valid_to_reply_to?
return info_request.recipient_email
else
- return incoming_message_followup.mail.from_addrs[0].spec
+ return incoming_message_followup.from_email
end
end
# Subject to use for followup
diff --git a/app/models/raw_email.rb b/app/models/raw_email.rb
index bae144931..de7978b82 100644
--- a/app/models/raw_email.rb
+++ b/app/models/raw_email.rb
@@ -22,7 +22,7 @@ class RawEmail < ActiveRecord::Base
if request_id.empty?
raise "Failed to find the id number of the associated request: has it been saved?"
end
-
+
if ENV["RAILS_ENV"] == "test"
return File.join(Rails.root, 'files/raw_email_test')
else
@@ -49,7 +49,7 @@ class RawEmail < ActiveRecord::Base
end
def data
- File.open(self.filepath, "rb").read
+ File.open(self.filepath, "r").read
end
def destroy_file_representation!
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb
index 90c4c6b53..493d6961c 100644
--- a/app/models/request_mailer.rb
+++ b/app/models/request_mailer.rb
@@ -204,15 +204,14 @@ class RequestMailer < ApplicationMailer
#
# That is because we want to be sure we properly record the actual message
# received in its raw form - so any information won't be lost in a round
- # trip via TMail, or by bugs in it, and so we can use something other than
- # TMail at a later date. And so we can offer an option to download the
+ # trip via the mail handler, or by bugs in it, and so we can use something
+ # other than TMail at a later date. And so we can offer an option to download the
# actual original mail sent by the authority in the admin interface (so
# can check that attachment decoding failures are problems in the message,
# not in our code). ]
def self.receive(raw_email)
logger.info "Received mail:\n #{raw_email}" unless logger.nil?
- mail = TMail::Mail.parse(raw_email)
- mail.base64_decode
+ mail = MailHandler.mail_from_raw_email(raw_email)
new.receive(mail, raw_email)
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 70386f7e4..6e1e21481 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -203,7 +203,7 @@ class User < ActiveRecord::Base
# For use in to/from in email messages
def name_and_email
- return TMail::Address.address_from_name_and_email(self.name, self.email).to_s
+ return MailHandler.address_from_name_and_email(self.name, self.email)
end
# The "internal admin" is a special user for internal use.
diff --git a/app/views/comment/_single_comment.rhtml b/app/views/comment/_single_comment.rhtml
index 013e5e107..b645721cf 100644
--- a/app/views/comment/_single_comment.rhtml
+++ b/app/views/comment/_single_comment.rhtml
@@ -11,7 +11,7 @@
</h2>
<div class="comment_in_request_text">
<p>
- <img class="comment_quote" src="/images/quote.png" alt="">
+ <img class="comment_quote" src="/images/quote-marks.png" alt="">
<%= comment.get_body_for_html_display %>
</p>
</div>
diff --git a/app/views/help/api.rhtml b/app/views/help/api.rhtml
index 76d2992fb..facddce41 100644
--- a/app/views/help/api.rhtml
+++ b/app/views/help/api.rhtml
@@ -51,11 +51,11 @@
<dd>
<p>Quite a few pages have JSON versions, which let you download information about
objects in a structured form. Find them by:
+ </p>
<ul>
<li>Adding <tt>.json</tt> to the end of the URL. </li>
<li>Look for the <tt>&lt;link rel="alternate" type="application/json"&gt;</tt> tag in the head of the HTML. </li>
</ul>
- </p>
<p>Requests, users and authorities all have JSON versions containing basic
information about them. Every Atom feed has a JSON equivalent, containing
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml
index 76bdbd2dd..8c4ae588b 100644
--- a/app/views/layouts/default.rhtml
+++ b/app/views/layouts/default.rhtml
@@ -12,7 +12,7 @@
<link rel="shortcut icon" href="/favicon.ico">
<%= render :partial => 'general/stylesheet_includes' %>
- <% if session[:using_admin] %>
+ <% if is_admin? %>
<%= stylesheet_link_tag "/adminbootstraptheme/stylesheets/admin", :title => "Main", :rel => "stylesheet" %>
<% end %>
@@ -63,7 +63,7 @@
</script>
<% end %>
-<% if session[:using_admin] %>
+<% if is_admin? %>
<%= render :partial => 'admin_general/admin_navbar' %>
<% end %>
@@ -140,11 +140,11 @@
</div>
<%
unless Configuration::ga_code.empty? || (@user && @user.super?) %>
- <script>
+ <script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
- <script>
+ <script type="text/javascript">
var pageTracker = _gat._getTracker("<%= Configuration::ga_code %>");
pageTracker._trackPageview();
</script>
diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.rhtml
index bcfc93657..99c6c7d26 100644
--- a/app/views/request/_correspondence.rhtml
+++ b/app/views/request/_correspondence.rhtml
@@ -1,5 +1,5 @@
<div class="ff-print-fix"></div>
-<%
+<%
if !info_request_event.nil? && info_request_event.event_type == 'response'
incoming_message = info_request_event.incoming_message
end
@@ -21,9 +21,9 @@ if not incoming_message.nil?
<p class="event_actions">
<% if !@user.nil? && @user.admin_page_links? %>
- <%= link_to "Admin", admin_url("request/show_raw_email/" + incoming_message.raw_email_id.to_s) %> |
+ <%= link_to "Admin", admin_url("request/show_raw_email/" + incoming_message.raw_email_id.to_s) %> |
<% end %>
- <%= link_to _("Link to this"), incoming_message_url(incoming_message), :class => "link_to_this" %>
+ <%= link_to _("Link to this"), incoming_message_url(incoming_message), :class => "link_to_this" %>
</p>
</div>
<%
@@ -39,28 +39,28 @@ elsif [ 'sent', 'followup_sent' ].include?(info_request_event.event_type)
<%= render :partial => 'bubble', :locals => { :body => outgoing_message.get_body_for_html_display(), :attachments => nil } %>
- <p class="event_actions">
+ <p class="event_actions">
<% if outgoing_message.status == 'ready' && !@info_request.is_external? %>
<strong>Warning:</strong> This message has <strong>not yet been sent</strong> for an unknown reason.
- <% end %>
+ <% end %>
<!-- Can use this to get name of who followup was too, if say you
play with proper from display, but not sure needed
<% if outgoing_message.message_type == 'followup' && !outgoing_message.incoming_message_followup.nil? && !outgoing_message.incoming_message_followup.safe_mail_from.nil? %>
- Follow up sent to: <%=h outgoing_message.incoming_message_followup.safe_mail_from %>
- <% end %>
+ Follow up sent to: <%=h outgoing_message.incoming_message_followup.safe_mail_from %>
+ <% end %>
-->
- <%= link_to _("Link to this"), outgoing_message_url(outgoing_message), :class => "link_to_this" %>
+ <%= link_to _("Link to this"), outgoing_message_url(outgoing_message), :class => "link_to_this" %>
</p>
</div>
<% elsif [ 'resent', 'followup_resent' ].include?(info_request_event.event_type) %>
- <div class="outgoing correspondence" id="outgoing-<%=outgoing_message.id.to_s%>">
+ <div class="outgoing correspondence" id="outgoing-<%=info_request_event.outgoing_message.id.to_s%>">
<h2>
<%= simple_date(info_request_event.created_at) %>
</h2>
- <p class="event_plain">
- Sent
+ <p class="event_plain">
+ Sent
<% if info_request_event.outgoing_message.message_type == 'initial_request' %>
request
<% elsif info_request_event.outgoing_message.message_type == 'followup' %>
@@ -72,7 +72,7 @@ elsif [ 'sent', 'followup_sent' ].include?(info_request_event.event_type)
to <%= public_body_link(@info_request.public_body) %> again<% if not info_request_event.same_email_as_previous_send? %>, using a new contact address<% end %>.
</p>
</div>
-<% elsif info_request_event.event_type == 'comment'
+<% elsif info_request_event.event_type == 'comment'
comment = info_request_event.comment
%>
<%= render :partial => 'comment/single_comment', :locals => { :comment => comment } %>
diff --git a/app/views/request/select_authority.rhtml b/app/views/request/select_authority.rhtml
index 521136f8e..1166c3ff9 100644
--- a/app/views/request/select_authority.rhtml
+++ b/app/views/request/select_authority.rhtml
@@ -31,7 +31,7 @@
<div id="authority_selection">
<% form_tag({:controller => "request", :action => "select_authority"}, {:id => "search_form", :method => "get"}) do %>
- <p>
+ <div>
<p>
<%= _('First, type in the <strong>name of the UK public authority</strong> you\'d
like information from. <strong>By law, they have to respond</strong>
@@ -40,7 +40,7 @@
<%= text_field_tag 'query', params[:query], { :size => 30 } %>
<%= hidden_field_tag 'bodies', 1 %>
<%= submit_tag _('Search') %>
- </p>
+ </div>
<% end %>
<div id="typeahead_response">
<% if !@xapian_requests.nil? %>
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index cf1f971d9..e3ddf3b1b 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -22,11 +22,10 @@
</div>
<% end %>
-<%= render :partial => 'sidebar' %>
-
<div id="left_column">
<h1><%=h(@info_request.title)%></h1>
+
<% if !@info_request.is_external? && @info_request.user.profile_photo %>
<p class="user_photo_on_request">
<img src="<%= get_profile_photo_url(:url_name => @info_request.user.url_name) %>" alt="">
@@ -148,3 +147,4 @@
<%= render :partial => 'after_actions' %>
</div>
+<%= render :partial => 'sidebar' %>
diff --git a/app/views/user/_show_user_info.rhtml b/app/views/user/_show_user_info.rhtml
index 5dfecee1e..3c229e9ce 100644
--- a/app/views/user/_show_user_info.rhtml
+++ b/app/views/user/_show_user_info.rhtml
@@ -1,7 +1,7 @@
<% if !@display_user.get_about_me_for_html_display.empty? || @is_you %>
<div class="user_about_me">
- <img class="comment_quote" src="/images/quote.png" alt="">
+ <img class="comment_quote" src="/images/quote-marks.png" alt="">
<%= @display_user.get_about_me_for_html_display %>
<% if @is_you %>
(<%= link_to _("edit text about you"), set_profile_about_me_url() %>)
diff --git a/app/views/user/sign.rhtml b/app/views/user/sign.rhtml
index 4704ea95a..6a1979155 100644
--- a/app/views/user/sign.rhtml
+++ b/app/views/user/sign.rhtml
@@ -1,16 +1,16 @@
+
<% if !@post_redirect.nil? && @post_redirect.reason_params[:user_name] %>
<% @title = _("Sign in") %>
-
<div id="sign_alone">
<p id="sign_in_reason">
<% if @post_redirect.reason_params[:web].empty? %>
<%= _('Please sign in as ')%><%= link_to h(@post_redirect.reason_params[:user_name]), @post_redirect.reason_params[:user_url] %>.
<% else %>
- <%= @post_redirect.reason_params[:web] %>,
+ <%= @post_redirect.reason_params[:web] %>,
<%= _('please sign in as ')%><%= link_to h(@post_redirect.reason_params[:user_name]), @post_redirect.reason_params[:user_url] %>.
<% end %>
- </p>
+ </p>
<% if @post_redirect.post_params["controller"] == "admin_general" %>
<p id="superuser_message">Don't have a superuser account yet? <%= link_to "Sign in as the emergency user", @post_redirect.uri + "?emergency=1" %></p>
<% end %>
@@ -22,7 +22,16 @@
<% else %>
<% @title = _('Sign in or make a new account') %>
- <div id="sign_together">
+ <div id="sign_together">
+ <% if !@post_redirect.nil? %>
+ <p id="sign_in_reason">
+ <% if @post_redirect.reason_params[:web].empty? %>
+ <%= _('Please sign in or make a new account.') %>
+ <% else %>
+ <%= _('{{reason}}, please sign in or make a new account.', :reason => @post_redirect.reason_params[:web]) %>
+ <% end %>
+ </p>
+ <% end %>
<div id="left_half">
<h1><%= _('Sign in') %></h1>
<%= render :partial => 'signin', :locals => { :sign_in_as_existing_user => false } %>