bans: change expires_at field to duration.
Changes: * Change the `expires_at` field to `duration`. * Make moderators choose from a fixed set of standard ban lengths, instead of allowing arbitrary ban lengths. * List `duration` in seconds in the /bans.json API. * Dump bans to BigQuery. Note that some old bans have a negative duration. This is because their expiration date was before their creation date, which is because in 2013 bans were migrated to Danbooru 2 and the original ban creation dates were lost.
This commit is contained in:
@@ -84,26 +84,6 @@ class BanTest < ActiveSupport::TestCase
|
||||
CurrentUser.user = nil
|
||||
CurrentUser.ip_addr = nil
|
||||
end
|
||||
|
||||
context "when only expired bans exist" do
|
||||
setup do
|
||||
@ban = FactoryBot.create(:ban, :user => @user, :banner => @admin, :duration => -1)
|
||||
end
|
||||
|
||||
should "not return expired bans" do
|
||||
assert(!Ban.is_banned?(@user))
|
||||
end
|
||||
end
|
||||
|
||||
context "when active bans still exist" do
|
||||
setup do
|
||||
@ban = FactoryBot.create(:ban, :user => @user, :banner => @admin, :duration => 1)
|
||||
end
|
||||
|
||||
should "return active bans" do
|
||||
assert(Ban.is_banned?(@user))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user