aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/comments.rb61
-rw-r--r--app/models/contact_validator.rb4
-rw-r--r--app/models/incoming_message.rb4
-rw-r--r--app/models/info_request.rb4
-rw-r--r--app/models/info_request_event.rb4
-rw-r--r--app/models/outgoing_message.rb4
-rw-r--r--app/models/post_redirect.rb4
-rw-r--r--app/models/public_body.rb4
-rw-r--r--app/models/public_body_tag.rb4
-rw-r--r--app/models/track_thing.rb4
-rw-r--r--app/models/track_things_sent_email.rb4
-rw-r--r--app/models/user.rb4
-rw-r--r--app/models/user_info_request_sent_alert.rb4
-rw-r--r--app/views/comment/_comment_form.rhtml15
-rw-r--r--app/views/help/about.rhtml16
-rw-r--r--app/views/request/show.rhtml52
-rw-r--r--db/schema.rb12
-rw-r--r--todo.txt66
18 files changed, 208 insertions, 62 deletions
diff --git a/app/models/comments.rb b/app/models/comments.rb
new file mode 100644
index 000000000..00e58df55
--- /dev/null
+++ b/app/models/comments.rb
@@ -0,0 +1,61 @@
+# == Schema Information
+# Schema version: 62
+#
+# Table name: comments
+#
+# id :integer not null, primary key
+# user_id :integer not null
+# comment_type :string(255) default("internal_error"), not null
+# info_request_id :integer
+# body :text not null
+# visible :boolean default(true), not null
+# created_at :datetime not null
+# updated_at :datetime not null
+#
+
+# models/comments.rb:
+# A comment by a user upon something.
+#
+# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
+# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+#
+# $Id: comments.rb,v 1.1 2008-08-09 15:19:01 francis Exp $
+
+class Comments < ActiveRecord::Base
+ belongs_to :user
+ validates_presence_of :user
+
+ validates_inclusion_of :comment_type, :in => [ 'request' ]
+ belongs_to :info_request
+
+ def body
+ ret = read_attribute(:body)
+ if ret.nil?
+ return ret
+ end
+ ret = ret.strip
+ ret = ret.gsub(/(?:\n\s*){2,}/, "\n\n") # remove excess linebreaks that unnecessarily space it out
+ ret
+ end
+ def raw_body
+ read_attribute(:body)
+ end
+
+ # Check have edited comment
+ def validate
+ if self.body.empty? || self.body =~ /^\s+$/
+ errors.add(:body, "^Please enter your annotation")
+ end
+ end
+
+ # Return body for display as HTML
+ def get_body_for_html_display
+ text = self.body.strip
+ text = CGI.escapeHTML(text)
+ text = MySociety::Format.make_clickable(text, :contract => 1)
+ text = text.gsub(/\n/, '<br>')
+ return text
+ end
+end
+
+
diff --git a/app/models/contact_validator.rb b/app/models/contact_validator.rb
index 9d114bd85..a0bcbf229 100644
--- a/app/models/contact_validator.rb
+++ b/app/models/contact_validator.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: contact_validators
#
@@ -15,7 +15,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: contact_validator.rb,v 1.18 2008-07-17 10:32:01 francis Exp $
+# $Id: contact_validator.rb,v 1.19 2008-08-09 15:19:01 francis Exp $
class ContactValidator < ActiveRecord::BaseWithoutTable
column :name, :string
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index ada3eeb7a..3f625f539 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: incoming_messages
#
@@ -19,7 +19,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: incoming_message.rb,v 1.128 2008-08-08 01:31:50 francis Exp $
+# $Id: incoming_message.rb,v 1.129 2008-08-09 15:19:01 francis Exp $
# TODO
# Move some of the (e.g. quoting) functions here into rblib, as they feel
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 447ff6c1a..da82f8ab4 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: info_requests
#
@@ -23,7 +23,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: info_request.rb,v 1.125 2008-07-30 13:31:00 francis Exp $
+# $Id: info_request.rb,v 1.126 2008-08-09 15:19:01 francis Exp $
require 'digest/sha1'
require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian')
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 15e758275..4eff38554 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: info_request_events
#
@@ -20,7 +20,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: info_request_event.rb,v 1.49 2008-07-17 10:32:01 francis Exp $
+# $Id: info_request_event.rb,v 1.50 2008-08-09 15:19:01 francis Exp $
class InfoRequestEvent < ActiveRecord::Base
belongs_to :info_request
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index b5e9f7786..d02037374 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: outgoing_messages
#
@@ -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.57 2008-07-30 13:31:00 francis Exp $
+# $Id: outgoing_message.rb,v 1.58 2008-08-09 15:19:01 francis Exp $
class OutgoingMessage < ActiveRecord::Base
belongs_to :info_request
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index edc9ed63f..21130d515 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: post_redirects
#
@@ -26,7 +26,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: post_redirect.rb,v 1.36 2008-07-17 10:32:01 francis Exp $
+# $Id: post_redirect.rb,v 1.37 2008-08-09 15:19:01 francis Exp $
require 'openssl' # for random bytes function
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index dd19f6d00..4a51f4e51 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: public_bodies
#
@@ -23,7 +23,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: public_body.rb,v 1.94 2008-08-07 20:46:32 johncross Exp $
+# $Id: public_body.rb,v 1.95 2008-08-09 15:19:01 francis Exp $
require 'csv'
require 'set'
diff --git a/app/models/public_body_tag.rb b/app/models/public_body_tag.rb
index 4f5e48fdb..af459b35b 100644
--- a/app/models/public_body_tag.rb
+++ b/app/models/public_body_tag.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: public_body_tags
#
@@ -15,7 +15,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: public_body_tag.rb,v 1.15 2008-07-17 10:32:01 francis Exp $
+# $Id: public_body_tag.rb,v 1.16 2008-08-09 15:19:01 francis Exp $
class PublicBodyTag < ActiveRecord::Base
validates_presence_of :public_body
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index c6215660e..c266c2167 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: track_things
#
@@ -21,7 +21,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_thing.rb,v 1.34 2008-08-09 00:47:45 francis Exp $
+# $Id: track_thing.rb,v 1.35 2008-08-09 15:19:01 francis Exp $
class TrackThing < ActiveRecord::Base
belongs_to :tracking_user, :class_name => 'User'
diff --git a/app/models/track_things_sent_email.rb b/app/models/track_things_sent_email.rb
index ccfc79cb4..f21cf4d2c 100644
--- a/app/models/track_things_sent_email.rb
+++ b/app/models/track_things_sent_email.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: track_things_sent_emails
#
@@ -18,7 +18,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_things_sent_email.rb,v 1.9 2008-07-17 10:32:01 francis Exp $
+# $Id: track_things_sent_email.rb,v 1.10 2008-08-09 15:19:01 francis Exp $
class TrackThingsSentEmail < ActiveRecord::Base
belongs_to :info_request_event
diff --git a/app/models/user.rb b/app/models/user.rb
index 515c4e733..9c160dbd5 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: users
#
@@ -21,7 +21,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user.rb,v 1.60 2008-07-28 17:59:41 francis Exp $
+# $Id: user.rb,v 1.61 2008-08-09 15:19:01 francis Exp $
require 'digest/sha1'
diff --git a/app/models/user_info_request_sent_alert.rb b/app/models/user_info_request_sent_alert.rb
index c80c834b8..af3c6e981 100644
--- a/app/models/user_info_request_sent_alert.rb
+++ b/app/models/user_info_request_sent_alert.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 60
+# Schema version: 62
#
# Table name: user_info_request_sent_alerts
#
@@ -17,7 +17,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user_info_request_sent_alert.rb,v 1.19 2008-07-17 10:32:01 francis Exp $
+# $Id: user_info_request_sent_alert.rb,v 1.20 2008-08-09 15:19:01 francis Exp $
class UserInfoRequestSentAlert < ActiveRecord::Base
belongs_to :user
diff --git a/app/views/comment/_comment_form.rhtml b/app/views/comment/_comment_form.rhtml
new file mode 100644
index 000000000..d1ce0a61a
--- /dev/null
+++ b/app/views/comment/_comment_form.rhtml
@@ -0,0 +1,15 @@
+<% form_for(:comment, @comment) do |o| %>
+ <p>
+ <%= o.text_area :body, :rows => 10, :cols => 55 %>
+ </p>
+
+ <p>
+ Don't bother posting up nonsense (<a href="/help/about#moderation">like what sort of nonsense?</a>).
+ </p>
+
+ <p>
+ <%= hidden_field_tag 'submitted_comment', 1 %>
+ <%= submit_tag "Add public annotation" %>
+ </p>
+<% end %>
+
diff --git a/app/views/help/about.rhtml b/app/views/help/about.rhtml
index a8dfa216d..e9434f379 100644
--- a/app/views/help/about.rhtml
+++ b/app/views/help/about.rhtml
@@ -184,6 +184,22 @@ address should be treated as the return address."
</p>
</dd>
+<dt id="moderation">What will you do to me if I annotate requests with nonsense?</dt>
+
+<dd>
+<p>It won't be pretty :). </p>
+<p>Seriously, annotations on WhatDoTheyKnow are to help
+people get the information they want, or to give them pointers to places they
+can go to help them act on it. We reserve the right to remove anything else.
+Endless, content-free political discussions are not allowed, but
+do post a link to a suitable forum elsewhere.</p>
+<p>For example, if you think you know the reason someone posted a request,
+and you don't approve of it, do not write a complex rant in the annotation.
+Instead, simply write a short sentence, and link to another website which
+already explains it in detail.
+</p>
+<dd>
+
</dl>
<h1 id="officers">FOI officer questions</h1>
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index 136b75499..e5ac5b008 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -97,6 +97,58 @@
<% for info_request_event in @info_request_events %>
<%= render :partial => 'correspondence', :locals => { :info_request_event => info_request_event } %>
<% end %>
+
+ <!--
+
+ <div id="comment_form">
+ <h2>Add an annotation</h2>
+
+ <p>
+ Help the requester with their request. Things you can do:
+ </p>
+
+ <ul>
+
+ <% if [ 'waiting_clarification' ].include?(@info_request.described_state) %>
+ <li> Advise on how to <strong>best clarify</strong> the request.</li>
+ <% end %>
+
+ <% if @info_request.awaiting_description %>
+ <% end %>
+
+ <% if not [ 'successful', 'partially_successful' ].include?(@info_request.described_state) %>
+ <li> Link to the information requested, if it is <strong>already available</strong> on the Internet. </li>
+ <li> Suggest <strong>where else</strong> the requester might find the information. </li>
+ <li> Offer better ways of <strong>wording the request</strong> to get the information. </li>
+ <% end %>
+
+ <% if [ 'successful', 'partially_successful' ].include?(@info_request.described_state) %>
+ <li> <strong>Summarise</strong> the content of any information returned. </li>
+ <li> Say how you've <strong>used the information</strong>, with links if possible. </li>
+ <li> <strong>Thank</strong> the local authority or <%=h @info_request.user.name %>. </li>
+ <% end %>
+ <% if [ 'partially_successful' ].include?(@info_request.described_state) %>
+ <li> Suggest how the requester can find the <strong>rest of the information</strong>. </li>
+ <% end %>
+ <% if [ 'successful', 'partially_successful' ].include?(@info_request.described_state) %>
+ <li> Point to <strong>related information</strong>, campaigns or forums which may be useful. </li>
+ <% end %>
+
+ <% if [ 'not_held' ].include?(@info_request.described_state) %>
+ <li> Ideas on what <strong>other documents to request</strong> which the authority may hold. </li>
+ <% end %>
+ <% if [ 'rejected' ].include?(@info_request.described_state) %>
+ <li> Advise on whether the <strong>rejection is legal</strong>, and how to complain about if not. </li>
+ <% end %>
+
+ <% if [ 'requires_admin' ].include?(@info_request.described_state) %>
+ <li> Your thoughts on what the WhatDoTheyKnow <strong>administrators</strong> should do about the request. </li>
+ <% end %>
+
+ </ul>
+
+ <%= render :partial => 'comment/comment_form', :locals => { } %>
+ </div> -->
</div>
diff --git a/db/schema.rb b/db/schema.rb
index 7c94e4622..b53ac9e8e 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 61) do
+ActiveRecord::Schema.define(:version => 62) do
create_table "acts_as_xapian_jobs", :force => true do |t|
t.string "model", :null => false
@@ -19,6 +19,16 @@ ActiveRecord::Schema.define(:version => 61) do
add_index "acts_as_xapian_jobs", ["model", "model_id"], :name => "index_acts_as_xapian_jobs_on_model_and_model_id", :unique => true
+ create_table "comments", :force => true do |t|
+ t.integer "user_id", :null => false
+ t.string "comment_type", :default => "internal_error", :null => false
+ t.integer "info_request_id"
+ t.text "body", :null => false
+ t.boolean "visible", :default => true, :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "incoming_messages", :force => true do |t|
t.integer "info_request_id", :null => false
t.text "raw_data", :null => false
diff --git a/todo.txt b/todo.txt
index f5c6ea66c..67bbfc2d8 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,46 +1,37 @@
-RSS move:
- Get test code working
- Add some tests
-
- Remove find_tracking_people
-
-http://www.whatdotheyknow.com/request/communications_about_whatdotheyk
- Mask all emails from binary attachments
-Say "followup sent to" rather than "sent to" http://www.whatdotheyknow.com/feed/user/richard_jackson
-Make links in notes clickable
- http://www.whatdotheyknow.com/body/hesa
-Spacing on green boxes is rubbish
-
Site move:
Install PostgresSQL 8.3
Move database
Move email foibackup to a new server
-FOI requests (that need action)
-============
-
-Internal review:
-http://www.whatdotheyknow.com/request/search_engine_advertising_bought
-http://www.whatdotheyknow.com/request/communications_from_home_office_
-http://www.whatdotheyknow.com/request/crime_investigation_following_al
-http://www.whatdotheyknow.com/request/determination_of_pricing_for_pro#incoming-2902
-(search for it!)
-
-
Next
====
-Internal review status/marker?
-Request withdrawn by user status/marker?
+Green box when you are classifying request is a bit too big / prominent
+Solicit people to tell us requests are misclassified?
+
+Search for user.name, esp. ./contact_mailer/user_message.rhtml
Comments interleaved with body
+ - Allow anyone logged in to add a comment to any request.
+ - Add an event too
+ - Index it all in Xapian
+ - Add it to the spec fixtures
+ - Add basic tests
+ - Make sure it works in email alerts
- Email people when comments on their own request
+ - Email people subscribed to people about new comments that they make
+ ... and likewise to requests, public bodies
-Redo the RSS feeds
-- Look at Rob's TWFY.nz interface
-- One click "track this" then single feed based on your preferences
-- Page tracking things within the site
-Maybe remove public tracking completely
+http://www.whatdotheyknow.com/request/communications_about_whatdotheyk
+ Mask all emails from binary attachments
+
+Internal review status/marker?
+ http://www.whatdotheyknow.com/request/search_engine_advertising_bought
+ http://www.whatdotheyknow.com/request/communications_from_home_office_
+ http://www.whatdotheyknow.com/request/crime_investigation_following_al
+ http://www.whatdotheyknow.com/request/determination_of_pricing_for_pro#incoming-2902
+ (search for it!)
+Request withdrawn by user status/marker?
Do something about shared spreadsheet
@@ -57,6 +48,12 @@ Clear out all the need classifying requests
Later
=====
+This doesn't work:
+http://www.whatdotheyknow.com/search/status:waiting_classification/
+
+Link the overdue date to an explanation of what bank holidays it skipped etc.
+:)
+
When indexing .docx do you need to index docProps/custom.xml and docProps/app.xml
as well as word/document.xml ? (thread on xapian-discuss does so)
@@ -123,11 +120,7 @@ Link more clearly to full request and next/previous correspondence (ask Matthew)
e.g. http://www.flickr.com/groups/central/discuss/72157604494352123/72157604515433851/
Get Atom highlighting to include stylesheet for yellow somehow
-When you click RSS feed when on own request, default to RSS in the choice on next page
-Offer option of a feed with the union of all your feeds (tartarus asked for this).
-
-Just make RSS normal like on other sites rather than something you have to
-register for.
+Offer option of one RSS feed with all things you are tracking in it. Maybe.
"Some of the information" option should give you choice of complaining if you like.
@@ -137,7 +130,6 @@ Preview when sending followups - especially people need to see quoting/subject
Spell checking for followups
For followups, have radio button to say is it a new request or followup?
-
Interface for when you change your email address - easier to do now with post_redirect.circumstance?
Tell application developer if working days table not up to date, and needs