aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/comment_controller.rb
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-09-19 15:32:27 +0100
committerRobin Houston <robin.houston@gmail.com>2012-09-19 15:32:27 +0100
commit550f143a9c9be1ebdfe257fe853a2adf1e13973c (patch)
tree64890a49f5f567392bd1b7be7cc0c582329f66a9 /app/controllers/comment_controller.rb
parentdd533b28f1101a4150365bbd7f16f276396364e8 (diff)
Add an option to disable comments on a request
Closes #30.
Diffstat (limited to 'app/controllers/comment_controller.rb')
-rw-r--r--app/controllers/comment_controller.rb7
1 files changed, 7 insertions, 0 deletions
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?