aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin_request_controller.rb5
-rw-r--r--app/controllers/comment_controller.rb7
2 files changed, 11 insertions, 1 deletions
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index 7cf23e61e..53ff2957b 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.rb
@@ -71,6 +71,7 @@ class AdminRequestController < AdminController
old_allow_new_responses_from = @info_request.allow_new_responses_from
old_handle_rejected_responses = @info_request.handle_rejected_responses
old_tag_string = @info_request.tag_string
+ old_comments_allowed = @info_request.comments_allowed
@info_request.title = params[:info_request][:title]
@info_request.prominence = params[:info_request][:prominence]
@@ -81,6 +82,7 @@ class AdminRequestController < AdminController
@info_request.allow_new_responses_from = params[:info_request][:allow_new_responses_from]
@info_request.handle_rejected_responses = params[:info_request][:handle_rejected_responses]
@info_request.tag_string = params[:info_request][:tag_string]
+ @info_request.comments_allowed = params[:info_request][:comments_allowed] == "true" ? true : false
if @info_request.valid?
@info_request.save!
@@ -92,7 +94,8 @@ class AdminRequestController < AdminController
:old_awaiting_description => old_awaiting_description, :awaiting_description => @info_request.awaiting_description,
:old_allow_new_responses_from => old_allow_new_responses_from, :allow_new_responses_from => @info_request.allow_new_responses_from,
:old_handle_rejected_responses => old_handle_rejected_responses, :handle_rejected_responses => @info_request.handle_rejected_responses,
- :old_tag_string => old_tag_string, :tag_string => @info_request.tag_string
+ :old_tag_string => old_tag_string, :tag_string => @info_request.tag_string,
+ :old_comments_allowed => old_comments_allowed, :tag_string => @info_request.comments_allowed
})
# expire cached files
expire_for_request(@info_request)
diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb
index 1552017c2..988a8a6f8 100644
--- a/app/controllers/comment_controller.rb
+++ b/app/controllers/comment_controller.rb
@@ -23,6 +23,13 @@ class CommentController < ApplicationController
else
raise "Unknown type " + params[:type]
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, so we just raise an exception.
+ raise "Comments are not allowed on this request" if !@info_request.comments_allowed?
# Banned from adding comments?
if !authenticated_user.nil? && !authenticated_user.can_make_comments?