flags: move flagging inside Post#delete!

This commit is contained in:
evazion
2017-05-17 22:48:01 -05:00
parent 6bebc3f694
commit 565945ab7b
4 changed files with 21 additions and 26 deletions

View File

@@ -14,8 +14,7 @@ module Moderator
def delete
@post = ::Post.find(params[:id])
if params[:commit] == "Delete"
@post.flag!(params[:reason], :is_deletion => true)
@post.delete!(:reason => params[:reason], :move_favorites => params[:move_favorites].present?)
@post.delete!(params[:reason], :move_favorites => params[:move_favorites].present?)
end
redirect_to(post_path(@post))
end