aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2010-10-09 02:11:10 +0100
committerFrancis Irving <francis@mysociety.org>2010-10-09 02:11:10 +0100
commitf656f1700beb4dea3e70dd4be3e55d3590394551 (patch)
tree8921cf3a64874a46cfde3bd5cc8f710068d8ecbe
parentc8af5673bb9cd45f97ca4b76745fccb2ed1a8d0f (diff)
Return information about request events in API.
-rw-r--r--app/controllers/request_controller.rb22
-rw-r--r--app/views/request/details.rhtml3
2 files changed, 21 insertions, 4 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 6e7df2e17..167667725 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -86,9 +86,25 @@ class RequestController < ApplicationController
:law_used => @info_request.law_used,
:tags => @info_request.tag_array,
- # not sure we need to make these admin params public
- # :allow_new_responses_from => @info_request.allow_new_responses_from,
- # :handle_rejected_responses => @info_request.handle_rejected_responses,
+ # not sure we need to make these, mainly anti-spam, admin params public
+ # allow_new_responses_from
+ # handle_rejected_responses
+
+ :info_request_events => @info_request_events.map { |e| {
+ :id => e.id,
+ :event_type => e.event_type,
+ # params_yaml has possibly sensitive data in it, don't include it
+ :created_at => e.created_at,
+ :described_state => e.described_state,
+ :calculated_state => e.calculated_state,
+ :last_described_at => e.last_described_at,
+ :incoming_message_id => e.incoming_message_id,
+ :outgoing_message_id => e.outgoing_message_id,
+ :comment_id => e.comment_id,
+ # XXX would be nice to add links here, but alas the
+ # code to make them is in views only. See views/request/details.rhtml
+ } }
+
}
}
end
diff --git a/app/views/request/details.rhtml b/app/views/request/details.rhtml
index db7e652f6..03e5148ef 100644
--- a/app/views/request/details.rhtml
+++ b/app/views/request/details.rhtml
@@ -51,4 +51,5 @@ the most recent event had its status updated to that value. <strong>calculated</
WhatDoTheyKnow for intermediate events, which weren't given an explicit
description by a user. See the <a href="/search">search tips</a> for description of the states.</p>
-
+<p>You can get this page in computer-readable format as part of the main JSON
+page for the request. See the <a href="/help/api">API documentation</a>.</p>