FIX: Prompt for the wizard for the first admin who logs in

This commit is contained in:
Robin Ward 2016-09-16 11:48:47 -04:00
parent c80eff1907
commit 4f9a7aa769
2 changed files with 6 additions and 5 deletions

View file

@ -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?

View file

@ -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