flags: adjust limit to 5 flags at once.

This commit is contained in:
evazion
2020-08-12 12:42:48 -05:00
parent 5917587fd5
commit dd8c3fad2c
2 changed files with 4 additions and 4 deletions

View File

@@ -356,7 +356,7 @@ class User < ApplicationRecord
def is_flag_limited? def is_flag_limited?
return false if has_unlimited_flags? return false if has_unlimited_flags?
post_flags.pending.count >= 10 post_flags.pending.count >= 5
end end
# Flags are unlimited if you're an approver or you have at least 30 flags # Flags are unlimited if you're an approver or you have at least 30 flags

View File

@@ -21,15 +21,15 @@ class PostFlagTest < ActiveSupport::TestCase
assert_equal(false, @user.is_flag_limited?) assert_equal(false, @user.is_flag_limited?)
assert_nothing_raised do assert_nothing_raised do
create_list(:post_flag, 11, creator: @user, status: :pending) create_list(:post_flag, 6, creator: @user, status: :pending)
end end
end end
end end
context "a basic user" do context "a basic user" do
should "be able to flag up to 10 posts" do should "be able to flag up to 5 posts" do
@user = create(:user) @user = create(:user)
@flags = create_list(:post_flag, 10, creator: @user, status: :pending) @flags = create_list(:post_flag, 5, creator: @user, status: :pending)
@flag = build(:post_flag, creator: @user, status: :pending) @flag = build(:post_flag, creator: @user, status: :pending)
assert_equal(false, @flag.valid?) assert_equal(false, @flag.valid?)