Merge pull request #2804 from evazion/feat-comment-as-mod
Add option to comment as moderator (fix #2799)
This commit is contained in:
@@ -23,12 +23,12 @@ class CommentsController < ApplicationController
|
||||
def update
|
||||
@comment = Comment.find(params[:id])
|
||||
check_privilege(@comment)
|
||||
@comment.update_attributes(params[:comment].permit(:body))
|
||||
@comment.update(update_params, :as => CurrentUser.role)
|
||||
respond_with(@comment, :location => post_path(@comment.post_id))
|
||||
end
|
||||
|
||||
def create
|
||||
@comment = Comment.create(params[:comment])
|
||||
@comment = Comment.create(create_params, :as => CurrentUser.role)
|
||||
respond_with(@comment) do |format|
|
||||
format.html do
|
||||
if @comment.errors.any?
|
||||
@@ -110,4 +110,12 @@ private
|
||||
raise User::PrivilegeError
|
||||
end
|
||||
end
|
||||
|
||||
def create_params
|
||||
params.require(:comment).permit(:post_id, :body, :do_not_bump_post, :is_sticky)
|
||||
end
|
||||
|
||||
def update_params
|
||||
params.require(:comment).permit(:body, :is_deleted, :is_sticky)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user