forked from e621ng/e621ng
[EmailBlacklist] Only unverify exact domain matches
This commit is contained in:
parent
d867ffcded
commit
3b714dd726
@ -61,7 +61,8 @@ class EmailBlacklist < ApplicationRecord
|
||||
end
|
||||
|
||||
def unverify_accounts
|
||||
matching_users = User.search(email_matches: "*@*#{domain}")
|
||||
# Only unverify exact domain matches
|
||||
matching_users = User.search(email_matches: "*@#{domain}")
|
||||
return if matching_users.count > UNVERIFY_COUNT_TRESHOLD
|
||||
|
||||
matching_users.each(&:mark_unverified!)
|
||||
|
@ -37,11 +37,14 @@ class EmailBlacklistTest < ActiveSupport::TestCase
|
||||
|
||||
should "unverify accounts if there are few matches" do
|
||||
@domain_blocked_user = create(:user, email: "0@domain.com")
|
||||
@other_user = create(:user, email: "0@somethingelse.xynzs")
|
||||
@other_user1 = create(:user, email: "0@prefix.domain.com")
|
||||
@other_user2 = create(:user, email: "0@somethingelse.xynzs")
|
||||
EmailBlacklist.create(creator: @user, domain: "domain.com", reason: "test")
|
||||
@domain_blocked_user.reload
|
||||
@other_user.reload
|
||||
@other_user1.reload
|
||||
@other_user2.reload
|
||||
assert_not @domain_blocked_user.is_verified?
|
||||
assert @other_user.is_verified?
|
||||
assert @other_user1.is_verified?
|
||||
assert @other_user2.is_verified?
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user