diff options
29 files changed, 185 insertions, 95 deletions
diff --git a/app/controllers/admin_track_controller.rb b/app/controllers/admin_track_controller.rb index fee2911b3..af0a6c0e7 100644 --- a/app/controllers/admin_track_controller.rb +++ b/app/controllers/admin_track_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: admin_track_controller.rb,v 1.1 2008-05-16 18:28:07 francis Exp $ +# $Id: admin_track_controller.rb,v 1.2 2008-05-21 10:51:24 francis Exp $ class AdminTrackController < ApplicationController layout "admin" @@ -16,10 +16,6 @@ class AdminTrackController < ApplicationController :conditions => @query.nil? ? nil : ["track_query ilike '%'||?||'%'", @query ] end - def show - @track_thing = TrackThing.find(params[:id]) - end - private end diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 6decd6591..fffb32871 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: application.rb,v 1.45 2008-05-15 17:40:43 francis Exp $ +# $Id: application.rb,v 1.46 2008-05-21 10:51:24 francis Exp $ class ApplicationController < ActionController::Base @@ -134,7 +134,7 @@ class ApplicationController < ActionController::Base elsif sortby == 'newest' return ['created_at', false] elsif sortby == 'described' - return ['rss_at', false] # use this for RSS + return ['described_at', false] # use this for some RSS else raise "Unknown sort order " + @sortby end diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 5853f4ba3..7802b701e 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -5,7 +5,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: general_controller.rb,v 1.27 2008-05-19 23:28:39 francis Exp $ +# $Id: general_controller.rb,v 1.28 2008-05-21 10:51:24 francis Exp $ class GeneralController < ApplicationController @@ -57,6 +57,8 @@ class GeneralController < ApplicationController # in config/routes.rb for comments. combined = params[:combined] sortby = nil + # XXX currently /described isn't linked to anywhere, just used in RSS and for /list/successful + # This is because it's confusingly different from /newest - but still useful for power users. if combined.size > 1 and (combined[-1] == 'newest' or combined[-1] == 'described') sortby = combined[-1] combined = combined[0..-2] diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 698a6a576..0d0ba505b 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: request_controller.rb,v 1.90 2008-05-19 23:28:39 francis Exp $ +# $Id: request_controller.rb,v 1.91 2008-05-21 10:51:24 francis Exp $ class RequestController < ApplicationController @@ -58,7 +58,7 @@ class RequestController < ApplicationController sortby = "newest" @track_thing = TrackThing.create_track_for_all_new_requests elsif @view == 'successful' - @title = "Recent successful responses" + @title = "Recently successful responses" query = 'variety:response (status:successful OR status:partially_successful)' sortby = "described" @track_thing = TrackThing.create_track_for_all_successful_requests diff --git a/app/models/contact_validator.rb b/app/models/contact_validator.rb index 2738c9571..1e88fa8a7 100644 --- a/app/models/contact_validator.rb +++ b/app/models/contact_validator.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 55 +# Schema version: 56 # # 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.14 2008-05-19 12:01:22 francis Exp $ +# $Id: contact_validator.rb,v 1.15 2008-05-21 10:51:24 francis Exp $ class ContactValidator < ActiveRecord::BaseWithoutTable column :name, :string diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 5d3c15f49..d4bc322f5 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -1,13 +1,14 @@ # == Schema Information -# Schema version: 55 +# Schema version: 56 # # Table name: incoming_messages # -# id :integer not null, primary key -# info_request_id :integer not null -# raw_data :text not null -# created_at :datetime not null -# updated_at :datetime not null +# id :integer not null, primary key +# info_request_id :integer not null +# raw_data :text not null +# created_at :datetime not null +# updated_at :datetime not null +# cached_attachment_text :text # # models/incoming_message.rb: @@ -17,7 +18,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.102 2008-05-19 13:54:39 francis Exp $ +# $Id: incoming_message.rb,v 1.103 2008-05-21 10:51:24 francis Exp $ # TODO # Move some of the (e.g. quoting) functions here into rblib, as they feel @@ -566,6 +567,14 @@ text = IncomingMessage.mask_string_multicharset(text, 'request-144-a724c835@what # Returns text version of attachment text def get_attachment_text + if self.cached_attachment_text.nil? + attachment_text = self.get_attachment_text_internal + self.cached_attachment_text = attachment_text + self.save! + end + return self.cached_attachment_text + end + def get_attachment_text_internal text = '' attachments = self.get_attachments_for_display for attachment in attachments diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 1f30c3cbb..ece806009 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 55 +# Schema version: 56 # # Table name: info_requests # @@ -22,7 +22,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.112 2008-05-19 12:01:22 francis Exp $ +# $Id: info_request.rb,v 1.113 2008-05-21 10:51:24 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 3926780c7..dfb930358 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 55 +# Schema version: 56 # # 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.45 2008-05-19 21:28:07 francis Exp $ +# $Id: info_request_event.rb,v 1.46 2008-05-21 10:51:24 francis Exp $ class InfoRequestEvent < ActiveRecord::Base belongs_to :info_request @@ -59,7 +59,7 @@ class InfoRequestEvent < ActiveRecord::Base # Full text search indexing acts_as_xapian :texts => [ :search_text_main, :title ], :values => [ [ :created_at, 0, "created_at", :date ], - [ :rss_at, 1, "rss_at", :number ], # XXX using number for lack of :datetime support in Xapian + [ :described_at_numeric, 1, "described_at", :number ], # XXX using :number for lack of :datetime support in Xapian values [ :request, 2, "request_collapse", :string ] ], :terms => [ [ :calculated_state, 'S', "status" ], @@ -79,13 +79,16 @@ class InfoRequestEvent < ActiveRecord::Base def request self.info_request.url_title end - def rss_at + def described_at # For responses, people might have RSS feeds on searches for type of # response (e.g. successful) in which case we want to date sort by # when the responses was described as being of the type. For other # types, just use the create at date. - date = self.last_described_at || self.created_at - return date.strftime("%Y%m%d%H%M%S") # format it here as no datetime support in Xapian's value ranges + return self.last_described_at || self.created_at + end + def described_at_numeric + # format it here as no datetime support in Xapian's value ranges + return self.described_at.strftime("%Y%m%d%H%M%S") end def search_text_main text = '' diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index cf906a1a1..75477706e 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 55 +# Schema version: 56 # # 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.49 2008-05-19 12:01:22 francis Exp $ +# $Id: outgoing_message.rb,v 1.50 2008-05-21 10:51:24 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 5f732e36a..a2e94836f 100644 --- a/app/models/post_redirect.rb +++ b/app/models/post_redirect.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 55 +# Schema version: 56 # # 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.32 2008-05-19 12:01:22 francis Exp $ +# $Id: post_redirect.rb,v 1.33 2008-05-21 10:51:24 francis Exp $ require 'openssl' # for random bytes function diff --git a/app/models/public_body.rb b/app/models/public_body.rb index e5f5cd667..03e74f2b7 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 55 +# Schema version: 56 # # Table name: public_bodies # @@ -21,7 +21,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.70 2008-05-19 12:01:22 francis Exp $ +# $Id: public_body.rb,v 1.71 2008-05-21 10:51:24 francis Exp $ require 'csv' require 'set' diff --git a/app/models/public_body_tag.rb b/app/models/public_body_tag.rb index 2bad6778c..414b903fb 100644 --- a/app/models/public_body_tag.rb +++ b/app/models/public_body_tag.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 55 +# Schema version: 56 # # 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.12 2008-05-19 12:01:22 francis Exp $ +# $Id: public_body_tag.rb,v 1.13 2008-05-21 10:51:24 francis Exp $ class PublicBodyTag < ActiveRecord::Base validates_presence_of :public_body diff --git a/app/models/track_mailer.rb b/app/models/track_mailer.rb index f581abc3a..bf92655af 100644 --- a/app/models/track_mailer.rb +++ b/app/models/track_mailer.rb @@ -4,7 +4,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: track_mailer.rb,v 1.11 2008-05-18 21:57:42 francis Exp $ +# $Id: track_mailer.rb,v 1.12 2008-05-21 10:51:24 francis Exp $ class TrackMailer < ApplicationMailer def event_digest(user, email_about_things) @@ -40,14 +40,16 @@ class TrackMailer < ApplicationMailer end end - # Query for things in this track - xapian_object = InfoRequest.full_search([InfoRequestEvent], track_thing.track_query, 'created_at', false, nil, 100, 1) + # Query for things in this track. We use described_at for the + # ordering, so we catch anything new (before described), or + # anything whose new status has been described. + xapian_object = InfoRequest.full_search([InfoRequestEvent], track_thing.track_query, 'described_at', false, nil, 200, 1) # Go through looking for unalerted things alert_results = [] for result in xapian_object.results if result[:model].class.to_s == "InfoRequestEvent" - if not done_info_request_events.include?(result[:model].id) and track_thing.created_at < result[:model].created_at + if not done_info_request_events.include?(result[:model].id) and track_thing.created_at < result[:model].described_at # OK alert this one alert_results.push(result) end diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb index 7fb72bff6..c63886071 100644 --- a/app/models/track_thing.rb +++ b/app/models/track_thing.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 55 +# Schema version: 56 # # 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.22 2008-05-19 12:01:22 francis Exp $ +# $Id: track_thing.rb,v 1.23 2008-05-21 10:51:24 francis Exp $ class TrackThing < ActiveRecord::Base belongs_to :tracking_user, :class_name => 'User' @@ -111,6 +111,8 @@ class TrackThing < ActiveRecord::Base :web => "To follow updates to the request '" + CGI.escapeHTML(self.info_request.title) + "'", :email => "Then you will be emailed whenever the request '" + CGI.escapeHTML(self.info_request.title) + "' is updated.", :email_subject => "Confirm you want to follow updates to the request '" + CGI.escapeHTML(self.info_request.title) + "'", + # RSS sorting + :feed_sortby => 'newest' } elsif self.track_type == 'all_new_requests' @params = { @@ -126,6 +128,8 @@ class TrackThing < ActiveRecord::Base :web => "To be told about any new requests", :email => "Then you will be emailed whenever anyone makes a new FOI request", :email_subject => "Confirm you want to be emailed about new requests", + # RSS sorting + :feed_sortby => 'newest' } elsif self.track_type == 'all_successful_requests' @params = { @@ -141,6 +145,11 @@ class TrackThing < ActiveRecord::Base :web => "To be told about any successful requests", :email => "Then you will be emailed whenever an FOI request succeeds", :email_subject => "Confirm you want to be emailed when an FOI request succeeds", + # RSS sorting - used described date, as newest would give a + # date for responses possibly days before description, so + # wouldn't appear at top of list when description (known + # success) causes match. + :feed_sortby => 'described' } elsif self.track_type == 'public_body_updates' @params = { @@ -156,6 +165,8 @@ class TrackThing < ActiveRecord::Base :web => "To be told about new requests to the public authority '" + CGI.escapeHTML(self.public_body.name) + "'", :email => "Then you will be emailed whenever someone requests something from '" + CGI.escapeHTML(self.public_body.name) + "'.", :email_subject => "Confirm you want to be told about new requests to '" + CGI.escapeHTML(self.public_body.name) + "'", + # RSS sorting + :feed_sortby => 'newest' } elsif self.track_type == 'user_updates' @params = { @@ -171,6 +182,8 @@ class TrackThing < ActiveRecord::Base :web => "To be told about new requests by '" + CGI.escapeHTML(self.tracked_user.name) + "'", :email => "Then you will be emailed whenever '" + CGI.escapeHTML(self.tracked_user.name) + "' requests something", :email_subject => "Confirm you want to be told about new requests by '" + CGI.escapeHTML(self.tracked_user.name) + "'", + # RSS sorting + :feed_sortby => 'newest' } elsif self.track_type == 'search_query' @params = { @@ -186,15 +199,18 @@ class TrackThing < ActiveRecord::Base :web => "To follow requests and responses matching '" + CGI.escapeHTML(self.track_query) + "'", :email => "Then you will be emailed whenever a new request or response matches '" + CGI.escapeHTML(self.track_query) + "'.", :email_subject => "Confirm you want to be told about new requests or responses matching '" + CGI.escapeHTML(self.track_query) + "'", + # RSS sorting - XXX hmmm, we don't really know which to use + # here for sorting. Might be a query term (e.g. 'cctv'), in + # which case newest is good, or might be something like + # all rejected requests in which case want to sort by + # described (when we discover criteria is met). Rather + # conservatively am picking described, as that will make + # things appear in feed more than the should, rather than less. + :feed_sortby => 'described' } else raise "unknown tracking type " + self.track_type end - - # for RSS sort by described date, as newest would give a date for - # responses possibly days before description, so wouldn't appear at top - # of list when description causes match. - params[:feed_sortby] = 'described' end return @params end diff --git a/app/models/track_things_sent_email.rb b/app/models/track_things_sent_email.rb index eede4b5fc..850f64880 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: 55 +# Schema version: 56 # # 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.6 2008-05-19 12:01:22 francis Exp $ +# $Id: track_things_sent_email.rb,v 1.7 2008-05-21 10:51:24 francis Exp $ class TrackThingsSentEmail < ActiveRecord::Base belongs_to :info_request_event diff --git a/app/models/user.rb b/app/models/user.rb index ec34c8a6f..cb0b6b867 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 55 +# Schema version: 56 # # 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.55 2008-05-19 12:01:22 francis Exp $ +# $Id: user.rb,v 1.56 2008-05-21 10:51:24 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 7af7a599a..872286c88 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: 55 +# Schema version: 56 # # 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.14 2008-05-19 12:01:22 francis Exp $ +# $Id: user_info_request_sent_alert.rb,v 1.15 2008-05-21 10:51:24 francis Exp $ class UserInfoRequestSentAlert < ActiveRecord::Base belongs_to :user diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml index 82e24db66..60c268f86 100644 --- a/app/views/general/search.rhtml +++ b/app/views/general/search.rhtml @@ -24,6 +24,9 @@ <%=link_to_unless @sortby.nil?, "Show most relevant results first", search_url(@query, nil) %> | <%=link_to_unless @sortby == 'newest', "Newest results first", search_url(@query, 'newest') %> + <% if @sortby == 'described' %> + | Recently described results first + <% end %> <% end %> <% if @total_hits == 0 %> diff --git a/app/views/help/about.rhtml b/app/views/help/about.rhtml index d4a3da4db..71890380e 100644 --- a/app/views/help/about.rhtml +++ b/app/views/help/about.rhtml @@ -160,27 +160,49 @@ that. <dl> <dt id="thanks">Which people made WhatDoTheyKnow?</dt> -<dd>Oh, nearly everyone (and <a href="http://www.mysociety.org/volunteertasks">maybe you too</a>)! <a href="http://www.yrtk.org">Heather Brooke</a> -(<a href="http://www.guardian.co.uk/politics/2008/mar/29/houseofcommons.michaelmartin?gusrc=rss&feed=worldnews">vampy!</a>) has -been pushing the idea of a UK FOI archive for years now. Both Phil Rodgers and -<a href="http://www.flourish.org/blog/">Francis Irving</a> -entered it in a mySociety competition for ideas for public interest websites to build. -<a href="http://www.mysociety.org/2006/09/27/the-mysociety-call-for-proposals-the-winner-and-runners-up/">It won</a>, -and then Chris Lightfoot (<a href="http://mk.ucant.org/archives/000129.html">RIP :(</a>) -thought up the wheeze of intercepting email responses to requests and -automatically publishing them. Tom Steinberg managed to get the cash to pay for the site out of -<a href="http://www.jrrt.org.uk/jrsstct.htm">a dead chocolate mogul</a>, so -that Francis Irving, Angie Ahl, Tommy Martin, Louise Crow, Matthew Somerville -and Tom Steinberg could do the complex mixture of design and coding to build -what you see today. Thanks particularly to Julian Todd (<a -href="http://www.freesteel.co.uk/wpblog/">great blog!</a>), Francis Davey, and -Etienne Pollard for using the site early on and giving feedback (and/or legal -advice!), and also to all our other users and testers. Lots of -people have been looking up FOI email addresses, and a few volunteering to -administrate the site - most especially Adam McGreggor, Alex Skene and John -Cross. Finally we couldn't do any of this without those +<dd>Oh, nearly everyone (and <a href="http://www.mysociety.org/volunteertasks">maybe you too</a>)! +<ul> +<li> + <a href="http://www.yrtk.org">Heather Brooke</a> + (<a href="http://www.guardian.co.uk/politics/2008/mar/29/houseofcommons.michaelmartin?gusrc=rss&feed=worldnews">vampy!</a>) has + been pushing the idea of a UK FOI archive for years now. +</li> +<li> + Both Phil Rodgers and <a href="http://www.flourish.org/blog/">Francis Irving</a> + entered it in a mySociety competition for ideas for public interest websites to build. +</li> +<li> + <a href="http://www.mysociety.org/2006/09/27/the-mysociety-call-for-proposals-the-winner-and-runners-up/">It won</a>, + and then Chris Lightfoot (<a href="http://mk.ucant.org/archives/000129.html">RIP :(</a>) + thought up the wheeze of intercepting email responses to requests and + automatically publishing them. +</li> +<li> + Tom Steinberg managed to get the cash to pay for the site out of + <a href="http://www.jrrt.org.uk/jrsstct.htm">a dead chocolate mogul</a> ... +</li> +<li> + ... so that Francis Irving, Angie Ahl, Tommy Martin, Louise Crow, Matthew Somerville + and Tom Steinberg could do the complex mixture of design and coding to build + what you see today. +</li> +<li> + Thanks particularly to Julian Todd (<a href="http://www.freesteel.co.uk/wpblog/">great blog!</a>), + Francis Davey, and Etienne Pollard for using the site early on and giving + feedback (and/or legal advice!), and also to all our other users and + testers. +</li> +<li> + Lots of people have been looking up FOI email addresses, and a few + volunteering to run the site - most especially Adam McGreggor, Alex + Skene and John Cross. +</li> +<li> +Finally we couldn't do any of this without those <a href="http://www.ukcod.org.uk/UKCOD_Trustees">crazy people</a> who volunteer, amongst many other things, to do the accounts and fill in our VAT return. +</li> +</ul> You're all stars. </dd> diff --git a/app/views/request/_request_listing_via_event.rhtml b/app/views/request/_request_listing_via_event.rhtml index 408229f94..dfd16decd 100644 --- a/app/views/request/_request_listing_via_event.rhtml +++ b/app/views/request/_request_listing_via_event.rhtml @@ -13,17 +13,7 @@ end %> <% end %> </span> <span class="desc"> - <% - # this will work, but will spawn catdoc and be slow! - #highlight_and_excerpt(event.search_text_main, @highlight_words, 150) - %> - <% if not event.outgoing_message.nil? %> - <%= highlight_and_excerpt(event.outgoing_message.body_without_salutation, @highlight_words, 150) %> - <% elsif not event.incoming_message.nil? %> - <%= highlight_and_excerpt(event.incoming_message.get_body_for_quoting, @highlight_words, 150) %> - <% else %> - <%= highlight_and_excerpt(info_request.initial_request_text, @highlight_words, 150) %> - <% end %> + <%= highlight_and_excerpt(event.search_text_main, @highlight_words, 150) %> </span> <span class="bottomline icon_<%= info_request.calculate_status %>"> diff --git a/db/migrate/055_stop_new_responses.rb b/db/migrate/055_stop_new_responses.rb index 9c9e7ad9f..1ebe2142a 100644 --- a/db/migrate/055_stop_new_responses.rb +++ b/db/migrate/055_stop_new_responses.rb @@ -4,6 +4,6 @@ class StopNewResponses < ActiveRecord::Migration end def self.down - remove :info_requests, :stop_new_responses + remove_column :info_requests, :stop_new_responses end end diff --git a/db/migrate/056_add_attachment_text.rb b/db/migrate/056_add_attachment_text.rb new file mode 100644 index 000000000..adcb97d5f --- /dev/null +++ b/db/migrate/056_add_attachment_text.rb @@ -0,0 +1,9 @@ +class AddAttachmentText < ActiveRecord::Migration + def self.up + add_column :incoming_messages, :cached_attachment_text, :text + end + + def self.down + remove_column :incoming_messages, :cached_attachment_text + end +end diff --git a/db/schema.rb b/db/schema.rb index 4004371b8..1bcf94dfa 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 => 55) do +ActiveRecord::Schema.define(:version => 56) do create_table "acts_as_xapian_jobs", :force => true do |t| t.string "model", :null => false @@ -20,10 +20,11 @@ ActiveRecord::Schema.define(:version => 55) 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 "incoming_messages", :force => true do |t| - t.integer "info_request_id", :null => false - t.text "raw_data", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "info_request_id", :null => false + t.text "raw_data", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "cached_attachment_text" end create_table "info_request_events", :force => true do |t| diff --git a/spec/controllers/admin_track_controller_spec.rb b/spec/controllers/admin_track_controller_spec.rb new file mode 100644 index 000000000..a7d983ab8 --- /dev/null +++ b/spec/controllers/admin_track_controller_spec.rb @@ -0,0 +1,10 @@ +require File.dirname(__FILE__) + '/../spec_helper' + +describe AdminTrackController, "when administering tracks" do + integrate_views + fixtures :track_things + + it "shows the list page" do + get :list + end +end diff --git a/spec/models/track_thing_spec.rb b/spec/models/track_thing_spec.rb new file mode 100644 index 000000000..32b5a23d5 --- /dev/null +++ b/spec/models/track_thing_spec.rb @@ -0,0 +1,12 @@ +require File.dirname(__FILE__) + '/../spec_helper' + +describe TrackThing, " when finding existing tracks" do +# it "should find the user when given the right email and password" do +# track_thing = jjo +# users(:silly_emnameem) +# track_things(:track_fancy_dog_search) +# +# found_track = TrackThing.find_by_existing_track() +# end + +end @@ -1,3 +1,19 @@ +CVS +--- + +Bullet list in credits on about page. +Rename rss_at to described_at. +Email alerts based on date of description, not just creation date (so don't +miss things that were created before alert but described only recently) +Tidy up when described vs. newest is used for sort order +Caching of text extracted from attachments, and display in search results. + + + +Test: Fix bug as to why "Vacant Council Housing Stock" didn't appear in my email +alert - i.e. created at date compared, not described at date. + + FOI requests to use to test it ============================== @@ -38,11 +54,6 @@ Or just look at referrers as Julian says Check test code coverage again - do we have all models -Reconsider described vs. newest sort order for the RSS for each track -separately -Bit confusing that sort order when you do "variety:successful" in query is by the date of creation. -Should probably use the described date a lot more often for dates. But not sure, hard to tell. - Advertise WDTK search queries on TWFY Advertise alerts on end pages with WDTK @@ -63,8 +74,8 @@ s = InfoRequest.find(:all).select { |i| (not i.awaiting_description) and i.get_l Museum aliases -Highlight text search finds in word docs Edits to outgoing/incoming/title won't be reindexed in Xapian (maybe just reindex all once a week) +Never update cached attachment text unless cache is explicitly cleared Make highlighting of search terms in RSS actually light up (maybe ask Tommy) diff --git a/vendor/plugins/acts_as_xapian/.cvsignore b/vendor/plugins/acts_as_xapian/.cvsignore index e1b470226..6379fb207 100644 --- a/vendor/plugins/acts_as_xapian/.cvsignore +++ b/vendor/plugins/acts_as_xapian/.cvsignore @@ -1 +1,2 @@ xapiandbs +.git diff --git a/vendor/plugins/acts_as_xapian/.gitignore b/vendor/plugins/acts_as_xapian/.gitignore new file mode 100644 index 000000000..3fad9cc85 --- /dev/null +++ b/vendor/plugins/acts_as_xapian/.gitignore @@ -0,0 +1,3 @@ +xapiandbs +CVS +*.swp diff --git a/vendor/plugins/acts_as_xapian/README.txt b/vendor/plugins/acts_as_xapian/README.txt index 2d8cd630e..2c332f8c9 100644 --- a/vendor/plugins/acts_as_xapian/README.txt +++ b/vendor/plugins/acts_as_xapian/README.txt @@ -111,7 +111,7 @@ triple of [ field, char, prefix ] where e.g. :terms => [ [ :variety, 'V', "variety" ] ] A 'field' is a symbol referring to either an attribute or a function which -returns the text, date or number to index. Both 'number' and 'char' must be +returns the text, date or number to index. Both 'identifier' and 'char' must be the same for the same prefix in different models. Alternatively, |