diff options
author | francis <francis> | 2008-09-22 02:36:03 +0000 |
---|---|---|
committer | francis <francis> | 2008-09-22 02:36:03 +0000 |
commit | b7c7ff8ba4dcbd3b0569be27770c6ba7c2a02cbf (patch) | |
tree | 937f59fbccfdcd2ecb6d72a83804aa4fab6e9489 /app/models | |
parent | 808bb964222c3fff757b9bf617e7eb542325705a (diff) |
Set default signature to be your name if you are logged in.
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/outgoing_message.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index 61990f2e6..0007482c3 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: outgoing_message.rb,v 1.63 2008-09-22 02:29:14 francis Exp $ +# $Id: outgoing_message.rb,v 1.64 2008-09-22 02:36:04 francis Exp $ class OutgoingMessage < ActiveRecord::Base belongs_to :info_request @@ -53,6 +53,15 @@ class OutgoingMessage < ActiveRecord::Base return "Yours faithfully," end end + def get_default_message + get_salutation + "\n\n\n\n" + get_signoff + "\n\n" + end + def set_signature_name(name) + # XXX We use raw_body here to get unstripped one + if self.raw_body == self.get_default_message + self.body = self.raw_body + name + end + end def body ret = read_attribute(:body) @@ -84,7 +93,7 @@ class OutgoingMessage < ActiveRecord::Base # Set default letter def after_initialize if self.body.nil? - self.body = get_salutation + "\n\n\n\n" + get_signoff + "\n\n" + self.body = get_default_message end end |