diff options
-rw-r--r-- | app/models/info_request.rb | 17 | ||||
-rw-r--r-- | app/views/request/_correspondence.rhtml | 15 |
2 files changed, 29 insertions, 3 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index db14a9cf1..159663691 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -23,7 +23,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request.rb,v 1.123 2008-07-17 10:33:57 francis Exp $ +# $Id: info_request.rb,v 1.124 2008-07-21 00:48:05 francis Exp $ require 'digest/sha1' require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian') @@ -550,6 +550,21 @@ public end end + # Get previous email sent to + def get_previous_email_sent_to(info_request_event) + last_email = nil + for e in self.info_request_events + if (e.event_type == 'sent' || e.event_type == 'resent') && e.outgoing_message_id == info_request_event.outgoing_message_id + if e.id == info_request_event.id + break + end + last_email = e.params[:email] + end + end + return last_email + end + + # Display version of status def display_status status = self.calculate_status diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.rhtml index 9d3aa2f66..c15d34b6f 100644 --- a/app/views/request/_correspondence.rhtml +++ b/app/views/request/_correspondence.rhtml @@ -52,9 +52,20 @@ elsif info_request_event.event_type == 'sent' || info_request_event.event_type = </div> <% elsif info_request_event.event_type == 'resent' %> <div class="correspondence"> + <h2> + <%= simple_date(info_request_event.created_at) %> + </h2> <p class="event_plain"> - Sent to <%= public_body_link(@info_request.public_body) %> - again (perhaps to a new contact address) <!-- XXX actually say if it is a new one or not --> + Sent + <% if info_request_event.outgoing_message.message_type == 'initial_request' %> + request + <% elsif info_request_event.outgoing_message.message_type == 'followup' %> + followup + <% else %> + <% raise "unknown message_type" %> + <% end %> + + to <%= public_body_link(@info_request.public_body) %> again<% if @info_request.get_previous_email_sent_to(info_request_event) != info_request_event.params[:email] %>, using a new contact address<% end %>. </p> </div> <% |