aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/comment_controller.rb
diff options
context:
space:
mode:
authorfrancis <francis>2008-09-02 14:57:30 +0000
committerfrancis <francis>2008-09-02 14:57:30 +0000
commit1a0231d072d3a969795ac470b0c818b2fedb3c75 (patch)
tree2137a53921cf62be7590b8ab89e7b6da492fba05 /app/controllers/comment_controller.rb
parent86987de63102417ce71bdda581b0ace91a8bd2c0 (diff)
Have a link to the annotation form, rather than the form being on the request.
(Partly to reduce clutter, partly to not overemphasise annotation vs. sending followups. Not sure if this is right, but will try it a bit.)
Diffstat (limited to 'app/controllers/comment_controller.rb')
-rw-r--r--app/controllers/comment_controller.rb23
1 files changed, 15 insertions, 8 deletions
diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb
index 8ac6d3850..ff49b2a79 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.5 2008-08-29 12:03:40 francis Exp $
+# $Id: comment_controller.rb,v 1.6 2008-09-02 14:57:31 francis Exp $
class CommentController < ApplicationController
@@ -12,19 +12,26 @@ class CommentController < ApplicationController
if params[:type] == 'request'
@info_request = InfoRequest.find_by_url_title(params[:url_title])
@track_thing = TrackThing.create_track_for_request(@info_request)
- @comment = Comment.new(params[:comment].merge({
- :comment_type => 'request',
- :user => @user
- }))
+ if params[:comment]
+ @comment = Comment.new(params[:comment].merge({
+ :comment_type => 'request',
+ :user => @user
+ }))
+ end
else
raise "Unknown type " + params[:type]
end
- # XXX this check should theoretically be a validation rule in the model
- @existing_comment = Comment.find_by_existing_comment(@info_request.id, params[:comment][:body])
+ if params[:comment]
+ # XXX this check should theoretically be a validation rule in the model
+ @existing_comment = Comment.find_by_existing_comment(@info_request.id, params[:comment][:body])
+ else
+ # Default to subscribing to request when first viewing form
+ params[:subscribe_to_request] = true
+ end
# See if values were valid or not
- if !@existing_comment.nil? || !@comment.valid? || params[:reedit]
+ if !params[:comment] || !@existing_comment.nil? || !@comment.valid? || params[:reedit]
render :action => 'new'
return
end