Files
danbooru/test/unit/mod_action_test.rb
evazion 3d03de1c52 mod actions: hide ip bans from non-mods.
Hide IP ban creation and deletion actions from non-mods in the
/mod_actions listing.

The previous approach of just filtering out the IP from the description
was hacky and didn't work with the `only` param (/mod_actions.json?only=id
still included the description field).
2019-12-16 12:20:41 -06:00

18 lines
476 B
Ruby

require 'test_helper'
class ModActionTest < ActiveSupport::TestCase
context "A mod action" do
setup do
@user = create(:user)
@mod = create(:moderator_user)
end
should "hide ip addresses from non-moderators in ip ban modactions" do
as(@mod) { create(:ip_ban, ip_addr: "1.1.1.1", reason: "test") }
as(@user) { assert_equal(0, ModAction.search({}).count) }
as(@mod) { assert_equal(1, ModAction.search({}).count) }
end
end
end