Prevent non-authors from viewing valuation comments

This commit is contained in:
Bertocq
2018-01-31 18:38:44 +01:00
parent fcf5e6223b
commit bca150bcd5

View File

@@ -21,8 +21,12 @@ class CommentsController < ApplicationController
def show def show
@comment = Comment.find(params[:id]) @comment = Comment.find(params[:id])
if @comment.valuation && @comment.author != current_user
raise ActiveRecord::RecordNotFound
else
set_comment_flags(@comment.subtree) set_comment_flags(@comment.subtree)
end end
end
def vote def vote
@comment.vote_by(voter: current_user, vote: params[:value]) @comment.vote_by(voter: current_user, vote: params[:value])