mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
FIX: Prompt for the wizard for the first admin who logs in
This commit is contained in:
parent
c80eff1907
commit
4f9a7aa769
2 changed files with 6 additions and 5 deletions
|
@ -76,7 +76,8 @@ class Wizard
|
||||||
def requires_completion?
|
def requires_completion?
|
||||||
return false unless SiteSetting.wizard_enabled?
|
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:
|
# In development mode all admins are developers, so the logic is a bit screwy:
|
||||||
unless Rails.env.development?
|
unless Rails.env.development?
|
||||||
|
|
|
@ -127,12 +127,12 @@ describe Wizard do
|
||||||
expect(build_simple(admin).requires_completion?).to eq(false)
|
expect(build_simple(admin).requires_completion?).to eq(false)
|
||||||
end
|
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)
|
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(admin).requires_completion?).to eq(false)
|
||||||
expect(build_simple(second_admin).requires_completion?).to eq(false)
|
expect(build_simple(second_admin).requires_completion?).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is false for staff when complete" do
|
it "is false for staff when complete" do
|
||||||
|
|
Loading…
Reference in a new issue