aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorDavid Cabo <david@calibea.com>2011-10-13 00:29:51 +0200
committerDavid Cabo <david@calibea.com>2011-10-13 00:29:51 +0200
commitc8983b923e4dc7db9ba22156daaddd94d2b5ed4d (patch)
tree7741c3655fe5e3cbc90dd20a4626ac7acc1bf6b0 /app/models/info_request.rb
parenta29b3aaf0ae77af49d38813b62dddcb6889c1ebe (diff)
parente13127a8ebc8bf8379d92f778af5a2bb6931d80c (diff)
Merge branch 'release/0.4'0.4
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb21
1 files changed, 14 insertions, 7 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index c667e1499..92322f74f 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -117,13 +117,13 @@ class InfoRequest < ActiveRecord::Base
# only check on create, so existing models with mixed case are allowed
def validate_on_create
if !self.title.nil? && !MySociety::Validate.uses_mixed_capitals(self.title, 10)
- errors.add(:title, N_('Please write the summary using a mixture of capital and lower case letters. This makes it easier for others to read.'))
+ errors.add(:title, _('Please write the summary using a mixture of capital and lower case letters. This makes it easier for others to read.'))
end
if !self.title.nil? && title.size > 200
- errors.add(:title, N_('Please keep the summary short, like in the subject of an email. You can use a phrase, rather than a full sentence.'))
+ errors.add(:title, _('Please keep the summary short, like in the subject of an email. You can use a phrase, rather than a full sentence.'))
end
if !self.title.nil? && self.title =~ /^(FOI|Freedom of Information)\s*requests?$/i
- errors.add(:title, N_('Please describe more what the request is about in the subject. There is no need to say it is an FOI request, we add that on anyway.'))
+ errors.add(:title, _('Please describe more what the request is about in the subject. There is no need to say it is an FOI request, we add that on anyway.'))
end
end
@@ -451,7 +451,7 @@ public
self.log_event("response", params)
self.save!
end
-
+ self.info_request_events.each { |event| event.xapian_mark_needs_index } # for the "waiting_classification" index
RequestMailer.deliver_new_response(self, incoming_message)
end
@@ -564,6 +564,7 @@ public
def calculate_event_states
curr_state = nil
for event in self.info_request_events.reverse
+ event.xapian_mark_needs_index # we need to reindex all events in order to update their latest_* terms
if curr_state.nil?
if !event.described_state.nil?
curr_state = event.described_state
@@ -779,8 +780,7 @@ public
# Display version of status
- def display_status
- status = self.calculate_status
+ def InfoRequest.get_status_description(status)
if status == 'waiting_classification'
_("Awaiting classification.")
elsif status == 'waiting_response'
@@ -818,6 +818,10 @@ public
end
end
+ def display_status
+ InfoRequest.get_status_description(self.calculate_status)
+ end
+
# Completely delete this request and all objects depending on it
def fully_destroy
self.track_things.each do |track_thing|
@@ -918,10 +922,13 @@ public
end
# List of incoming messages to followup, by unique email
- def who_can_followup_to
+ def who_can_followup_to(skip_message = nil)
ret = []
done = {}
for incoming_message in self.incoming_messages.reverse
+ if incoming_message == skip_message
+ next
+ end
incoming_message.safe_mail_from
email = OutgoingMailer.email_for_followup(self, incoming_message)