From 89f5ef7be8e464578ed9add6b5978ddf0ff39f09 Mon Sep 17 00:00:00 2001 From: francis Date: Tue, 26 Aug 2008 22:54:45 +0000 Subject: Prevent double posting of comments, and test code for that. --- app/controllers/comment_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/controllers/comment_controller.rb') diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb index 7192eb84b..fe2b31daf 100644 --- a/app/controllers/comment_controller.rb +++ b/app/controllers/comment_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: comment_controller.rb,v 1.2 2008-08-26 16:03:36 francis Exp $ +# $Id: comment_controller.rb,v 1.3 2008-08-26 22:54:45 francis Exp $ class CommentController < ApplicationController @@ -20,10 +20,10 @@ class CommentController < ApplicationController end # XXX this check should theoretically be a validation rule in the model - #@existing_comment = Comment.find_by_existing_comment(params[:info_request][:title], params[:info_request][:public_body_id], params[:outgoing_message][:body]) + @existing_comment = Comment.find_by_existing_comment(@info_request.id, params[:comment][:body]) # See if values were valid or not - if !@comment.valid? || params[:reedit] + if !@existing_comment.nil? || !@comment.valid? || params[:reedit] render :action => 'new' return end -- cgit v1.2.3