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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user