aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/outgoing_message.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/outgoing_message.rb')
-rw-r--r--app/models/outgoing_message.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index 4ca0d391d..8560f70bd 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.71 2008-10-28 13:04:20 francis Exp $
+# $Id: outgoing_message.rb,v 1.72 2008-11-05 18:19:46 francis Exp $
class OutgoingMessage < ActiveRecord::Base
belongs_to :info_request
@@ -32,6 +32,8 @@ class OutgoingMessage < ActiveRecord::Base
belongs_to :incoming_message_followup, :foreign_key => 'incoming_message_followup_id', :class_name => 'IncomingMessage'
+ validates_inclusion_of :what_doing, :in => ['new_information', 'internal_review', 'normal_sort']
+
# can have many events, for items which were resent by site admin e.g. if
# contact address changed
has_many :info_request_events
@@ -117,6 +119,9 @@ class OutgoingMessage < ActiveRecord::Base
if self.body =~ /#{get_signoff}\s*\Z/ms
errors.add(:body, '^Please sign at the bottom with your name, or alter the "' + get_signoff + '" signature')
end
+ if self.what_doing.nil?
+ errors.add(:what_doing_dummy, '^Please choose what sort of reply you are making.')
+ end
end
# Deliver outgoing message
@@ -139,6 +144,9 @@ class OutgoingMessage < ActiveRecord::Base
if self.info_request.described_state == 'waiting_clarification'
self.info_request.set_described_state('waiting_response')
end
+ if self.what_doing == 'internal_review'
+ self.info_request.set_described_state('internal_review')
+ end
else
raise "Message id #{self.id} has type '#{self.message_type}' which send_message can't handle"
end