votes: allow admins to remove post votes.
Allow admins to remove votes on posts. This is for fixing vote abuse. Votes can be removed by going to the vote list on the /post_votes page, or by clicking on a post's score, then using the "Remove" option in the "..." dropdown menu next to the vote. Votes are soft-deleted - they're marked as deleted in the database, but not fully deleted. Removed votes are only visible to admins, not to regular users. When a vote is removed by an admin, it leaves a mod action. Technically it's possible to undelete votes, but there's no UI for it.
This commit is contained in:
@@ -86,10 +86,14 @@ class FavoritesControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
context "destroy action" do
|
||||
should "remove the favorite for the current user" do
|
||||
assert_difference [-> { @faved_post.favorites.count }, -> { @faved_post.reload.fav_count }, -> { @user.reload.favorite_count }], -1 do
|
||||
delete_auth favorite_path(@faved_post.id), @user, as: :javascript
|
||||
assert_response :redirect
|
||||
end
|
||||
delete_auth favorite_path(@faved_post.id), @user, as: :javascript
|
||||
|
||||
assert_response :redirect
|
||||
assert_equal(0, @faved_post.favorites.count)
|
||||
assert_equal(0, @faved_post.reload.fav_count)
|
||||
assert_equal(0, @faved_post.votes.active.count)
|
||||
assert_equal(1, @faved_post.votes.deleted.count)
|
||||
assert_equal(0, @user.reload.favorite_count)
|
||||
end
|
||||
|
||||
should "allow banned users to destroy favorites" do
|
||||
|
||||
Reference in New Issue
Block a user