diff options
Diffstat (limited to 'app/controllers/comment_controller.rb')
-rw-r--r-- | app/controllers/comment_controller.rb | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb index 18544a98f..ce022f000 100644 --- a/app/controllers/comment_controller.rb +++ b/app/controllers/comment_controller.rb @@ -8,6 +8,7 @@ class CommentController < ApplicationController before_filter :check_read_only, :only => [ :new ] before_filter :find_info_request, :only => [ :new ] before_filter :create_track_thing, :only => [ :new ] + before_filter :reject_unless_comments_allowed, :only => [ :new ] protect_from_forgery :only => [ :new ] def new @@ -18,15 +19,6 @@ class CommentController < ApplicationController })) end - # Are comments disabled on this request? - # - # There is no “add comment” link when comments are disabled, so users should - # not usually hit this unless they are explicitly attempting to avoid the comment block - unless @info_request.comments_allowed? - redirect_to request_url(@info_request), :notice => "Comments are not allowed on this request" - return - end - # Banned from adding comments? if !authenticated_user.nil? && !authenticated_user.can_make_comments? @details = authenticated_user.can_fail_html @@ -104,4 +96,14 @@ class CommentController < ApplicationController @track_thing = TrackThing.create_track_for_request(@info_request) end + # Are comments disabled on this request? + # + # There is no “add comment” link when comments are disabled, so users should + # not usually hit this unless they are explicitly attempting to avoid the comment block + def reject_unless_comments_allowed + unless @info_request.comments_allowed? + redirect_to request_url(@info_request), :notice => "Comments are not allowed on this request" + end + end + end |