aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2008-01-21 11:08:15 +0000
committerfrancis <francis>2008-01-21 11:08:15 +0000
commita42e48d0b8f45971d550ffed31dabf878cc4966e (patch)
treef656c1283c3c14d7f21eb28ac45f8e692d021908
parent2a0fe2a2dc1c7be2019e1ea4c73f6c85dcfc6821 (diff)
Include name as well as email in to address in followup messages.
-rw-r--r--app/models/info_request_event.rb11
-rw-r--r--app/models/request_mailer.rb5
-rw-r--r--spec/controllers/request_controller_spec.rb1
-rw-r--r--spec/fixtures/incoming_messages.yml4
-rw-r--r--todo.txt8
5 files changed, 21 insertions, 8 deletions
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 706db9d20..9e4d8f6b9 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -15,14 +15,21 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: info_request_event.rb,v 1.5 2008-01-10 01:13:28 francis Exp $
+# $Id: info_request_event.rb,v 1.6 2008-01-21 11:08:16 francis Exp $
class InfoRequestEvent < ActiveRecord::Base
belongs_to :info_request
validates_presence_of :info_request
validates_presence_of :event_type
- validates_inclusion_of :event_type, :in => ['sent', 'resent', 'followup_sent', 'followup_resent', 'edit_outgoing']
+ validates_inclusion_of :event_type, :in => [
+ 'sent',
+ 'resent',
+ 'followup_sent',
+ 'followup_resent',
+ 'edit_outgoing', # outgoing message edited in admin interface
+ 'manual' # you did something in the db by hand
+ ]
# We store YAML version of parameters in the database
def params=(params)
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb
index ea4d635f1..747d8ae46 100644
--- a/app/models/request_mailer.rb
+++ b/app/models/request_mailer.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: request_mailer.rb,v 1.18 2008-01-14 12:22:36 francis Exp $
+# $Id: request_mailer.rb,v 1.19 2008-01-21 11:08:16 francis Exp $
class RequestMailer < ApplicationMailer
def initial_request(info_request, outgoing_message)
@@ -19,12 +19,11 @@ class RequestMailer < ApplicationMailer
def followup(info_request, outgoing_message, incoming_message_followup)
@from = info_request.incoming_name_and_email
headers 'Sender' => info_request.envelope_name_and_email
- @recipients = incoming_message_followup.mail.from
+ @recipients = incoming_message_followup.mail.from_addrs.to_s
@subject = 'Re: Freedom of Information Request - ' + info_request.title
@body = {:info_request => info_request, :outgoing_message => outgoing_message,
:incoming_message_followup => incoming_message_followup,
:contact_email => MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost') }
-
end
def bounced_message(email)
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 0c23b41d9..5986e8fd1 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -220,6 +220,7 @@ describe RequestController, "when sending a followup message" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /What a useless response! You suck./
+ mail.to_addrs.to_s.should == "FOI Person <foiperson@localhost>"
response.should redirect_to(:controller => 'request', :action => 'show', :id => info_requests(:fancy_dog_request))
end
diff --git a/spec/fixtures/incoming_messages.yml b/spec/fixtures/incoming_messages.yml
index 63c2ebfdf..819a54bdc 100644
--- a/spec/fixtures/incoming_messages.yml
+++ b/spec/fixtures/incoming_messages.yml
@@ -3,8 +3,8 @@ useless_incoming_message:
info_request_id: 101
updated_at: 2007-11-13 18:09:20.042061
raw_data: |
- From: Francis Irving <frabcus@fastmail.fm>
- To: FOI Person <foiperson@localhost>
+ From: FOI Person <foiperson@localhost>
+ To: Bob Smith <bob@localhost>
Date: Tue, 13 Nov 2007 11:39:55 +0000
NoCc: foi+request-1-4b571715@cat
Bcc:
diff --git a/todo.txt b/todo.txt
index 94302797e..0131c4bf9 100644
--- a/todo.txt
+++ b/todo.txt
@@ -64,10 +64,12 @@ Brainstorm of things to say if c):
Next
====
+Use sent again date when there has been resent?, e.g. for
+ http://foi.mysociety.org/request/16
+
Followups:
- link to the follow up form, or embed in bottom of main request page
- don't show classify link on /response/ page
- - Copy the To: for followups properly (including name not just email)
Alert somewhere if working days table not up to date
Test it works if exim is down - e.g. not accepting connections
@@ -215,6 +217,10 @@ http://www.parliament.uk/parliamentary_publications_and_archives/freedom_of_info
Consider putting the requesting user's name in the request's magic email address
+Escape "www.liverpool.gov.uk <http://www.liverpool.gov.uk>" properly - so it doesn't catch
+the last > converted to &gt; too badly
+ http://localhost:3000/request/5?
+
Sources of public bodies
========================