diff --git a/app/assets/javascripts/discourse/app/components/bootstrap-mode-notice.hbs b/app/assets/javascripts/discourse/app/components/bootstrap-mode-notice.hbs
index b61e3bcc32..385d6b8eb3 100644
--- a/app/assets/javascripts/discourse/app/components/bootstrap-mode-notice.hbs
+++ b/app/assets/javascripts/discourse/app/components/bootstrap-mode-notice.hbs
@@ -1,21 +1,3 @@
-
-
-
- {{this.message}}
-
-
-
-
\ No newline at end of file
+
+ {{i18n "bootstrap_mode"}}
+
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/components/bootstrap-mode-notice.js b/app/assets/javascripts/discourse/app/components/bootstrap-mode-notice.js
index 69914cfa04..a139ee3c54 100644
--- a/app/assets/javascripts/discourse/app/components/bootstrap-mode-notice.js
+++ b/app/assets/javascripts/discourse/app/components/bootstrap-mode-notice.js
@@ -1,29 +1,11 @@
-import Component from "@glimmer/component";
-import { htmlSafe } from "@ember/template";
-import I18n from "I18n";
import { inject as service } from "@ember/service";
-import { action } from "@ember/object";
-import showModal from "discourse/lib/show-modal";
+import Component from "@glimmer/component";
export default class BootstrapModeNotice extends Component {
@service siteSettings;
- @service site;
- get message() {
- let msg = null;
- const bootstrapModeMinUsers = this.siteSettings.bootstrap_mode_min_users;
-
- if (bootstrapModeMinUsers > 0) {
- msg = "bootstrap_mode_enabled";
- } else {
- msg = "bootstrap_mode_disabled";
- }
-
- return htmlSafe(I18n.t(msg, { count: bootstrapModeMinUsers }));
- }
-
- @action
- inviteUsers() {
- showModal("create-invite");
+ get href() {
+ const topicId = this.siteSettings.admin_quick_start_topic_id;
+ return `/t/-/${topicId}#bootstrap-mode-2`;
}
}
diff --git a/app/assets/javascripts/discourse/app/controllers/application.js b/app/assets/javascripts/discourse/app/controllers/application.js
index 653b509415..6ab68de881 100644
--- a/app/assets/javascripts/discourse/app/controllers/application.js
+++ b/app/assets/javascripts/discourse/app/controllers/application.js
@@ -41,18 +41,6 @@ export default Controller.extend({
return this.siteSettings.login_required && !this.currentUser;
},
- @discourseComputed(
- "siteSettings.bootstrap_mode_enabled",
- "router.currentRouteName"
- )
- showBootstrapModeNotice(bootstrapModeEnabled, currentRouteName) {
- return (
- this.currentUser?.get("staff") &&
- bootstrapModeEnabled &&
- !currentRouteName.startsWith("wizard")
- );
- },
-
@discourseComputed
showFooterNav() {
return this.capabilities.isAppWebview || this.capabilities.isiOSPWA;
diff --git a/app/assets/javascripts/discourse/app/templates/application.hbs b/app/assets/javascripts/discourse/app/templates/application.hbs
index 8958f774b3..da8724b2d6 100644
--- a/app/assets/javascripts/discourse/app/templates/application.hbs
+++ b/app/assets/javascripts/discourse/app/templates/application.hbs
@@ -48,9 +48,6 @@
{{/if}}
- {{#if this.showBootstrapModeNotice}}
-
- {{/if}}
`
+);
diff --git a/app/assets/javascripts/discourse/app/widgets/header-contents.js b/app/assets/javascripts/discourse/app/widgets/header-contents.js
index ba579498da..cdaa2f134d 100644
--- a/app/assets/javascripts/discourse/app/widgets/header-contents.js
+++ b/app/assets/javascripts/discourse/app/widgets/header-contents.js
@@ -14,6 +14,10 @@ createWidget("header-contents", {
{{#if attrs.topic}}
{{header-topic-info attrs=attrs}}
+ {{else if this.siteSettings.bootstrap_mode_enabled}}
+ {{#if this.currentUser.staff}}
+ {{header-bootstrap-mode attrs=attrs}}
+ {{/if}}
{{/if}}
{{yield}}
diff --git a/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js b/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js
index de3c793294..03be08812c 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/bootstrap-mode-notice-test.js
@@ -1,6 +1,6 @@
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
-import { click, currentURL, settled, visit } from "@ember/test-helpers";
+import { visit } from "@ember/test-helpers";
acceptance("Bootstrap Mode Notice", function (needs) {
needs.user({ admin: true });
@@ -10,37 +10,15 @@ acceptance("Bootstrap Mode Notice", function (needs) {
bootstrap_mode_min_users: 50,
});
- test("Navigation", async function (assert) {
+ test("is displayed if bootstrap mode is enabled", async function (assert) {
+ this.siteSettings.bootstrap_mode_enabled = true;
await visit("/");
- assert.ok(
- exists(".bootstrap-mode-notice"),
- "has the bootstrap mode notice"
- );
- assert.ok(
- exists(".bootstrap-invite-button"),
- "bootstrap notice has invite button"
- );
- assert.ok(
- exists(".bootstrap-wizard-link"),
- "bootstrap notice has wizard link"
- );
-
- await click(".bootstrap-invite-button");
- assert.ok(exists(".create-invite-modal"), "opens create invite modal");
-
- await click(".bootstrap-wizard-link");
- assert.strictEqual(
- currentURL(),
- "/wizard/steps/hello-world",
- "it transitions to the wizard page"
- );
+ assert.ok(exists(".bootstrap-mode"));
+ });
+ test("is hidden if bootstrap mode is disabled", async function (assert) {
this.siteSettings.bootstrap_mode_enabled = false;
await visit("/");
- await settled();
- assert.ok(
- !exists(".bootstrap-mode-notice"),
- "removes the notice when bootstrap mode is disabled"
- );
+ assert.ok(!exists(".bootstrap-mode"));
});
});
diff --git a/app/assets/stylesheets/common/base/header.scss b/app/assets/stylesheets/common/base/header.scss
index 8af17ba1fd..9eb279d976 100644
--- a/app/assets/stylesheets/common/base/header.scss
+++ b/app/assets/stylesheets/common/base/header.scss
@@ -445,3 +445,15 @@ $mobile-avatar-height: 1.532em;
margin-left: 5px;
}
}
+
+.d-header-mode {
+ background: var(--primary-low);
+ border-radius: 2em;
+ font-size: var(--font-down-1);
+ margin-left: 0.5em;
+ padding: 0.25em 0.5em;
+
+ a {
+ color: var(--primary-medium);
+ }
+}
diff --git a/app/jobs/regular/enable_bootstrap_mode.rb b/app/jobs/regular/enable_bootstrap_mode.rb
index 8b7d456f4c..811eee8475 100644
--- a/app/jobs/regular/enable_bootstrap_mode.rb
+++ b/app/jobs/regular/enable_bootstrap_mode.rb
@@ -5,11 +5,12 @@ module Jobs
sidekiq_options queue: "critical"
def execute(args)
- raise Discourse::InvalidParameters.new(:user_id) unless args[:user_id].present?
+ raise Discourse::InvalidParameters.new(:user_id) if !args[:user_id].present?
+
return if SiteSetting.bootstrap_mode_enabled
user = User.find_by(id: args[:user_id])
- return unless user.is_singular_admin?
+ return if !user.is_singular_admin?
# let's enable bootstrap mode settings
if SiteSetting.default_trust_level == TrustLevel[0]
diff --git a/app/jobs/scheduled/disable_bootstrap_mode.rb b/app/jobs/scheduled/disable_bootstrap_mode.rb
index e9d1db4288..67812c1f7a 100644
--- a/app/jobs/scheduled/disable_bootstrap_mode.rb
+++ b/app/jobs/scheduled/disable_bootstrap_mode.rb
@@ -5,21 +5,22 @@ module Jobs
every 1.day
def execute(args)
- return unless SiteSetting.bootstrap_mode_enabled
- total_users = User.human_users.count
+ return if !SiteSetting.bootstrap_mode_enabled
- if SiteSetting.bootstrap_mode_min_users == 0 ||
- total_users > SiteSetting.bootstrap_mode_min_users
- if SiteSetting.default_trust_level == TrustLevel[1]
- SiteSetting.set_and_log("default_trust_level", TrustLevel[0])
- end
-
- if SiteSetting.default_email_digest_frequency == 1440
- SiteSetting.set_and_log("default_email_digest_frequency", 10_080)
- end
-
- SiteSetting.set_and_log("bootstrap_mode_enabled", false)
+ if SiteSetting.bootstrap_mode_min_users != 0 &&
+ User.human_users.count <= SiteSetting.bootstrap_mode_min_users
+ return
end
+
+ if SiteSetting.default_trust_level == TrustLevel[1]
+ SiteSetting.set_and_log("default_trust_level", TrustLevel[0])
+ end
+
+ if SiteSetting.default_email_digest_frequency == 1440
+ SiteSetting.set_and_log("default_email_digest_frequency", 10_080)
+ end
+
+ SiteSetting.set_and_log("bootstrap_mode_enabled", false)
end
end
end
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index a55cc7b98c..219c60ac80 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -209,12 +209,7 @@ en:
message: "We've updated this site, please refresh, or you may experience unexpected behavior."
dismiss: "Dismiss"
- bootstrap_mode_enabled:
- one: "To make launching your new site easier, you are in bootstrap mode. All new users will be granted trust level 1 and have daily email summary emails enabled. This will be automatically turned off when %{count} user has joined."
- other: "To make launching your new site easier, you are in bootstrap mode. All new users will be granted trust level 1 and have daily email summary emails enabled. This will be automatically turned off when %{count} users have joined."
- bootstrap_mode_disabled: "Bootstrap mode will be disabled within 24 hours."
- bootstrap_invite_button_title: "Send Invites"
- bootstrap_wizard_link_title: "Finish setup wizard"
+ bootstrap_mode: "Bootstrap mode"
themes:
default_description: "Default"
diff --git a/config/site_settings.yml b/config/site_settings.yml
index 245a8c0c79..08e85af231 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -2482,6 +2482,7 @@ uncategorized:
admin_quick_start_topic_id:
default: -1
hidden: true
+ client: true
bootstrap_mode_min_users:
default: 50
diff --git a/docs/ADMIN-QUICK-START-GUIDE.md b/docs/ADMIN-QUICK-START-GUIDE.md
index 4a157b9428..bb88be3ac2 100644
--- a/docs/ADMIN-QUICK-START-GUIDE.md
+++ b/docs/ADMIN-QUICK-START-GUIDE.md
@@ -4,6 +4,10 @@ Congratulations, you are now the proud owner of your very own [Civilized Discour
If you haven't already, launch the [setup wizard](/wizard) and go through the steps to configure your site. You can run the wizard as many times as you want, it's completely safe!
+### Bootstrap Mode
+
+To make launching your new site easier, you are in bootstrap mode. All new users will be granted trust level 1 and have daily email summary emails enabled. This will be automatically turned off when more users have joined. To make the sign up process faster, consider [sending out invites](my/invited/pending).
+
### Admin Dashboard
Exercise your admin superpowers any time via the admin dashboard at