DEV: Avoid an additional query in `SpamHandler`.

* Also run query against human users only
This commit is contained in:
Guo Xiang Tan 2020-04-27 13:01:43 +08:00
parent e0725fd123
commit 76fc48b318
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20
1 changed files with 1 additions and 2 deletions

View File

@ -11,8 +11,7 @@ class SpamHandler
return false if tl2_plus_accounts_with_same_ip > 0
staff_user_ids = Group[:staff].user_ids - [-1]
staff_members_with_same_ip = User.where(id: staff_user_ids)
staff_members_with_same_ip = Group[:staff].users.human_users
.where(ip_address: ip_address.to_s)
.count