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 /app/models/info_request.rb | |
parent | e1e621112a368fa988cccbac7e87a2895289d0cc (diff) |
Fix bug when comparing new requests, caused by removal of space in body function.
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 5 |
1 files changed, 3 insertions, 2 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 |