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

@@ -15,26 +15,6 @@ module Moderator
end
end
context "confirm_delete action" do
should "render" do
get_auth confirm_delete_moderator_post_post_path(@post), @admin
assert_response :success
end
end
context "delete action" do
should "render" do
post_auth delete_moderator_post_post_path(@post), @admin, params: {:reason => "xxx", :format => "js", :commit => "Delete"}
assert(@post.reload.is_deleted?)
end
should "work even if the deleter has flagged the post previously" do
create(:post_flag, post: @post, creator: @admin)
post_auth delete_moderator_post_post_path(@post), @admin, params: {:reason => "xxx", :format => "js", :commit => "Delete"}
assert(@post.reload.is_deleted?)
end
end
context "confirm_move_favorites action" do
should "render" do
get_auth confirm_move_favorites_moderator_post_post_path(@post), @admin