diff --git a/lib/wizard.rb b/lib/wizard.rb index d30917f19..5fc99bee7 100644 --- a/lib/wizard.rb +++ b/lib/wizard.rb @@ -76,7 +76,8 @@ class Wizard def requires_completion? return false unless SiteSetting.wizard_enabled? - admins = User.where("admin = true and id <> ?", Discourse.system_user.id).order(:created_at) + admins = User.where("admin = true AND id <> ? AND auth_token_updated_at IS NOT NULL", + Discourse.system_user.id).order(:auth_token_updated_at) # In development mode all admins are developers, so the logic is a bit screwy: unless Rails.env.development? diff --git a/spec/components/wizard_spec.rb b/spec/components/wizard_spec.rb index 067e2bd14..6771df76c 100644 --- a/spec/components/wizard_spec.rb +++ b/spec/components/wizard_spec.rb @@ -127,12 +127,12 @@ describe Wizard do expect(build_simple(admin).requires_completion?).to eq(false) end - it "it's true for the first admin" do + it "it's true for the first admin who logs in" do admin = Fabricate(:admin) - expect(build_simple(admin).requires_completion?).to eq(true) + second_admin = Fabricate(:admin, auth_token_updated_at: Time.now) - second_admin = Fabricate(:admin) - expect(build_simple(second_admin).requires_completion?).to eq(false) + expect(build_simple(admin).requires_completion?).to eq(false) + expect(build_simple(second_admin).requires_completion?).to eq(true) end it "is false for staff when complete" do