FEATURE: Approve suspect users is now true by default. The suspect users list was removed (#9151)

This commit is contained in:
Roman Rizzi 2020-03-10 08:56:42 -03:00 committed by GitHub
parent 020c1b9cf3
commit 826b4793c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 41 deletions

View File

@ -6,7 +6,6 @@
{{nav-item route='adminUsersList.show' routeParam='staff' label='admin.users.nav.staff'}}
{{nav-item route='adminUsersList.show' routeParam='suspended' label='admin.users.nav.suspended'}}
{{nav-item route='adminUsersList.show' routeParam='silenced' label='admin.users.nav.silenced'}}
{{nav-item route='adminUsersList.show' routeParam='suspect' label='admin.users.nav.suspect'}}
{{nav-item route='adminUsersList.show' routeParam='staged' label='admin.users.nav.staged'}}
{{nav-item route='groups' label='groups.index.title'}}

View File

@ -7,8 +7,13 @@ module Jobs
def execute(_args)
return unless SiteSetting.approve_suspect_users
users = AdminUserIndexQuery.new
.suspect_users
users = User
.activated
.human_users
.joins(:user_profile, :user_stat)
.where("users.created_at <= ?", 1.day.ago)
.where("LENGTH(COALESCE(user_profiles.bio_raw, user_profiles.website, '')) > 0")
.where("user_stats.posts_read_count <= 1 AND user_stats.topics_entered <= 1")
.joins("LEFT OUTER JOIN reviewables r ON r.target_id = users.id AND r.target_type = 'User'")
.where('r.id IS NULL')
.limit(10)

View File

@ -4141,7 +4141,6 @@ en:
staff: "Staff"
suspended: "Suspended"
silenced: "Silenced"
suspect: "Suspect"
staged: "Staged"
approved: "Approved?"
titles:
@ -4158,7 +4157,6 @@ en:
moderators: "Moderators"
silenced: "Silenced Users"
suspended: "Suspended Users"
suspect: "Suspect Users"
staged: "Staged Users"
not_verified: "Not verified"
check_email:

View File

@ -862,7 +862,7 @@ posting:
default: 0
enum: "TrustLevelSetting"
approve_suspect_users:
default: false
default: true
approve_unless_staged:
default: false
notify_about_queued_posts_after:

View File

@ -78,16 +78,6 @@ class AdminUserIndexQuery
end
end
def suspect_users
@query
.activated
.human_users
.joins(:user_profile, :user_stat)
.where("users.created_at <= ?", 1.day.ago)
.where("LENGTH(COALESCE(user_profiles.bio_raw, user_profiles.website, '')) > 0")
.where("user_stats.posts_read_count <= 1 AND user_stats.topics_entered <= 1")
end
def filter_by_query_classification
case params[:query]
when 'staff' then @query.where("admin or moderator")
@ -96,7 +86,6 @@ class AdminUserIndexQuery
when 'silenced' then @query.silenced
when 'suspended' then @query.suspended
when 'pending' then @query.not_suspended.where(approved: false, active: true)
when 'suspect' then suspect_users
when 'staged' then @query.where(staged: true)
end
end

View File

@ -91,27 +91,6 @@ describe AdminUserIndexQuery do
end
describe 'with a suspected user' do
fab!(:bot) { Fabricate(:active_user, id: -10, created_at: 1.day.ago) }
fab!(:regular_user) { Fabricate(:user, created_at: 1.day.ago) }
fab!(:user_with_bio) { Fabricate(:active_user, created_at: 1.day.ago) }
fab!(:user_with_website) { Fabricate(:user, created_at: 1.day.ago) }
before do
user_with_website.user_profile.website = 'https://example.com'
user_with_website.user_profile.save!
end
it 'finds the suspected user' do
bot
regular_user
user_with_bio
user_with_website
query = AdminUserIndexQuery.new(query: 'suspect')
expect(query.find_users).to contain_exactly(user_with_bio, user_with_website)
end
end
describe "with a pending user" do
fab!(:user) { Fabricate(:user, active: true, approved: false) }

View File

@ -59,7 +59,7 @@ QUnit.test("switching tabs", async assert => {
const activeUser = "eviltrout";
const suspectUser = "sam";
const activeTitle = I18n.t("admin.users.titles.active");
const suspectTitle = I18n.t("admin.users.titles.suspect");
const suspectTitle = I18n.t("admin.users.titles.new");
await visit("/admin/users/list/active");
@ -70,7 +70,7 @@ QUnit.test("switching tabs", async assert => {
.includes(activeUser)
);
await click('a[href="/admin/users/list/suspect"]');
await click('a[href="/admin/users/list/new"]');
assert.equal(find(".admin-title h2").text(), suspectTitle);
assert.ok(

View File

@ -637,7 +637,7 @@ export function applyDefaultHandlers(pretender) {
return response(200, store);
});
pretender.get("/admin/users/list/suspect.json", () => {
pretender.get("/admin/users/list/new.json", () => {
return response(200, [
{
id: 2,