aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2014-08-28 15:43:46 +0100
committerGareth Rees <gareth@mysociety.org>2014-08-28 15:43:46 +0100
commitd801fff4325a42f1bbbb273ac0a4597c32b4dd4b (patch)
tree5b9d4828b2c6bf8415ccabb0140eb730ed12ceca /app/models/info_request.rb
parent0b511943ef5a8835af34842291725d1dce74b25a (diff)
parent533f0ab5f402e110f42d50fb6906a6b58ae312f7 (diff)
Merge remote-tracking branch 'origin/release/0.19'0.19
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 47ad435cb..aed651ad3 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -115,6 +115,16 @@ class InfoRequest < ActiveRecord::Base
states
end
+ # Subset of states accepted via the API
+ def self.allowed_incoming_states
+ [
+ 'waiting_response',
+ 'rejected',
+ 'successful',
+ 'partially_successful'
+ ]
+ end
+
# Possible reasons that a request could be reported for administrator attention
def report_reasons
[_("Contains defamatory material"),
@@ -387,16 +397,16 @@ public
# When constructing a new request, use this to check user hasn't double submitted.
- # XXX could have a date range here, so say only check last month's worth of new requests. If somebody is making
+ # TODO: could have a date range here, so say only check last month's worth of new requests. If somebody is making
# repeated requests, say once a quarter for time information, then might need to do that.
- # XXX this *should* also check outgoing message joined to is an initial
+ # TODO: this *should* also check outgoing message joined to is an initial
# request (rather than follow up)
def InfoRequest.find_existing(title, public_body_id, body)
return InfoRequest.find(:first, :conditions => [ "title = ? and public_body_id = ? and outgoing_messages.body = ?", title, public_body_id, body ], :include => [ :outgoing_messages ] )
end
def find_existing_outgoing_message(body)
- # XXX can add other databases here which have regexp_replace
+ # TODO: can add other databases here which have regexp_replace
if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
# Exclude spaces from the body comparison using regexp_replace
return self.outgoing_messages.find(:first, :conditions => [ "regexp_replace(outgoing_messages.body, '[[:space:]]', '', 'g') = regexp_replace(?, '[[:space:]]', '', 'g')", body ])
@@ -658,7 +668,7 @@ public
event.last_described_at = Time.now()
event.save!
end
- if event.last_described_at.nil? # XXX actually maybe this isn't needed
+ if event.last_described_at.nil? # TODO: actually maybe this isn't needed
event.last_described_at = Time.now()
event.save!
end
@@ -713,7 +723,7 @@ public
elsif event.event_type == 'resent'
last_sent = event
elsif expecting_clarification and event.event_type == 'followup_sent'
- # XXX this needs to cope with followup_resent, which it doesn't.
+ # TODO: this needs to cope with followup_resent, which it doesn't.
# Not really easy to do, and only affects cases where followups
# were resent after a clarification.
last_sent = event