diff options
author | francis <francis> | 2008-05-16 19:19:41 +0000 |
---|---|---|
committer | francis <francis> | 2008-05-16 19:19:41 +0000 |
commit | 7b58c144dcadce60295fddc89b787677a6881dfc (patch) | |
tree | 58fc107573e408b6c7c0d86f88b3308b820cd7f1 | |
parent | e1e621112a368fa988cccbac7e87a2895289d0cc (diff) |
Fix bug when comparing new requests, caused by removal of space in body function.
-rw-r--r-- | app/models/info_request.rb | 5 | ||||
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 6 | ||||
-rw-r--r-- | todo.txt | 6 |
3 files changed, 10 insertions, 7 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index dec1fe78d..64ed65a63 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -21,7 +21,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.110 2008-05-16 01:14:12 francis Exp $ +# $Id: info_request.rb,v 1.111 2008-05-16 19:19:42 francis Exp $ require 'digest/sha1' require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian') @@ -158,7 +158,8 @@ public # XXX this *should* also check outgoing message joined to is an initial # request (rather than follow up) def InfoRequest.find_by_existing_request(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 ] ) + # Exclude spaces from the body comparison + return InfoRequest.find(:first, :conditions => [ "title = ? and public_body_id = ? and regexp_replace(outgoing_messages.body, '[[:space:]]', '', 'g') = regexp_replace(?, '[[:space:]]', '', 'g')", title, public_body_id, body ], :include => [ :outgoing_messages ] ) end # A new incoming email to this request diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 411b2948b..d7a199a96 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -160,10 +160,12 @@ describe RequestController, "when creating a new request" do end it "should give an error if the same request is submitted twice" do + session[:user_id] = users(:bob_smith_user).id + post :new, :info_request => { :public_body_id => info_requests(:fancy_dog_request).public_body_id, - :title => info_requests(:fancy_dog_request).title}, + :title => info_requests(:fancy_dog_request).title }, :outgoing_message => { :body => info_requests(:fancy_dog_request).outgoing_messages[0].body}, - :submitted_new_request => 1, :preview => 0 + :submitted_new_request => 1, :preview => 0, :mouse_house => 1 response.should render_template('new') end @@ -38,8 +38,7 @@ Or just look at referrers as Julian says Test: In email alerts, show request heading somewhere -Add test code for search track emails - and also highling in RSS +Make highlightng in RSS actually light up Check test code coverage again - do we have all models @@ -48,7 +47,7 @@ Reconsider described vs. newest for the tracks Fix up the privacy policy Advertise WDTK search queries on TWFY -Show popular tracks somewhere (on admin, or not!) + Later ===== @@ -130,6 +129,7 @@ CSV export of lists of emails for admins Requests with related content - via a compare document search somehow? - using the tracking requests network +Show list of popular tracks somewhere (finds most popular requests in a way) Remember me box This can't possible be the best way, it is too depressing: |