mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 12:53:42 +08:00
FIX: Do not include non-human users on suspected users list.
https://meta.discourse.org/t/discobot-is-a-suspect-user/70558
This commit is contained in:
parent
6f5051861c
commit
c25730935e
|
@ -81,6 +81,7 @@ class AdminUserIndexQuery
|
||||||
where_conds << "user_stats.posts_read_count <= 1 AND user_stats.topics_entered <= 1"
|
where_conds << "user_stats.posts_read_count <= 1 AND user_stats.topics_entered <= 1"
|
||||||
|
|
||||||
@query.activated
|
@query.activated
|
||||||
|
.human_users
|
||||||
.references(:user_stats)
|
.references(:user_stats)
|
||||||
.includes(:user_profile)
|
.includes(:user_profile)
|
||||||
.where("COALESCE(user_profiles.bio_raw, '') != ''")
|
.where("COALESCE(user_profiles.bio_raw, '') != ''")
|
||||||
|
|
|
@ -90,8 +90,10 @@ describe AdminUserIndexQuery do
|
||||||
|
|
||||||
describe 'with a suspected user' do
|
describe 'with a suspected user' do
|
||||||
let(:user) { Fabricate(:active_user, created_at: 1.day.ago) }
|
let(:user) { Fabricate(:active_user, created_at: 1.day.ago) }
|
||||||
|
let(:bot) { Fabricate(:active_user, id: -10, created_at: 1.day.ago) }
|
||||||
|
|
||||||
it 'finds the suspected user' do
|
it 'finds the suspected user' do
|
||||||
|
bot
|
||||||
user
|
user
|
||||||
query = AdminUserIndexQuery.new(query: 'suspect')
|
query = AdminUserIndexQuery.new(query: 'suspect')
|
||||||
expect(query.find_users).to eq([user])
|
expect(query.find_users).to eq([user])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user