posts: rework post deletion to use dialog box.

Rework post deletion from using a separate page to using a dialog box,
like flagging.

* Add `DELETE /posts/:id` endpoint.
* Remove `POST /moderator/post/posts/:id/delete` endpoint.
This commit is contained in:
evazion
2020-08-03 19:28:10 -05:00
parent f1b0e31923
commit bca1f122d0
10 changed files with 69 additions and 62 deletions

View File

@@ -4,18 +4,6 @@ module Moderator
skip_before_action :api_check
respond_to :html, :json, :xml, :js
def confirm_delete
@post = ::Post.find(params[:id])
end
def delete
@post = authorize ::Post.find(params[:id])
if params[:commit] == "Delete"
@post.delete!(params[:reason], :move_favorites => params[:move_favorites].present?)
end
redirect_to(post_path(@post))
end
def confirm_move_favorites
@post = ::Post.find(params[:id])
end