ip bans: add hit counter, deleted flag, new ban type.
* Make IP bans soft deletable. * Add a hit counter to track how many times an IP ban has blocked someone. * Add a last hit timestamp to track when the IP ban last blocked someone. * Add a new type of IP ban, the signup ban. Signup bans restrict new signups from editing anything until they've verified their email address.
This commit is contained in:
@@ -21,6 +21,11 @@ class IpBansControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :redirect
|
||||
end
|
||||
end
|
||||
|
||||
should "log a mod action" do
|
||||
post_auth ip_bans_path, @admin, params: { ip_ban: { ip_addr: "1.2.3.4", reason: "xyz" }}
|
||||
assert_equal("ip_ban_create", ModAction.last.category)
|
||||
end
|
||||
end
|
||||
|
||||
context "index action" do
|
||||
@@ -37,12 +42,12 @@ class IpBansControllerTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
end
|
||||
|
||||
context "destroy action" do
|
||||
should "destroy an ip ban" do
|
||||
assert_difference("IpBan.count", -1) do
|
||||
delete_auth ip_ban_path(@ip_ban), @admin, params: {:format => "js"}
|
||||
assert_response :success
|
||||
end
|
||||
context "update action" do
|
||||
should "mark an ip ban as deleted" do
|
||||
put_auth ip_ban_path(@ip_ban), @admin, params: { ip_ban: { is_deleted: true }, format: "js" }
|
||||
assert_response :success
|
||||
assert_equal(true, @ip_ban.reload.is_deleted)
|
||||
assert_equal("ip_ban_delete", ModAction.last.category)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user