Compare commits
1 Commits
main
...
feature_bo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67d1fdb787 |
@ -1,21 +1,3 @@
|
|||||||
<div class="row bootstrap-mode-notice">
|
<a class="bootstrap-mode" href={{this.href}}>
|
||||||
<div class="alert alert-info alert-bootstrap-mode">
|
{{i18n "bootstrap_mode"}}
|
||||||
<div class="col-text">
|
</a>
|
||||||
{{this.message}}
|
|
||||||
</div>
|
|
||||||
<div class="col-button">
|
|
||||||
<div class="alert--button"><DButton
|
|
||||||
@icon="user-plus"
|
|
||||||
@action={{this.inviteUsers}}
|
|
||||||
@class="btn-primary bootstrap-invite-button"
|
|
||||||
@label="bootstrap_invite_button_title"
|
|
||||||
/></div>
|
|
||||||
{{#if this.site.wizard_required}}
|
|
||||||
<div class="alert--link"><a
|
|
||||||
class="bootstrap-wizard-link"
|
|
||||||
href="/wizard"
|
|
||||||
>{{i18n "bootstrap_wizard_link_title"}}</a></div>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@ -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 { inject as service } from "@ember/service";
|
||||||
import { action } from "@ember/object";
|
import Component from "@glimmer/component";
|
||||||
import showModal from "discourse/lib/show-modal";
|
|
||||||
|
|
||||||
export default class BootstrapModeNotice extends Component {
|
export default class BootstrapModeNotice extends Component {
|
||||||
@service siteSettings;
|
@service siteSettings;
|
||||||
@service site;
|
|
||||||
|
|
||||||
get message() {
|
get href() {
|
||||||
let msg = null;
|
const topicId = this.siteSettings.admin_quick_start_topic_id;
|
||||||
const bootstrapModeMinUsers = this.siteSettings.bootstrap_mode_min_users;
|
return `/t/-/${topicId}#bootstrap-mode-2`;
|
||||||
|
|
||||||
if (bootstrapModeMinUsers > 0) {
|
|
||||||
msg = "bootstrap_mode_enabled";
|
|
||||||
} else {
|
|
||||||
msg = "bootstrap_mode_disabled";
|
|
||||||
}
|
|
||||||
|
|
||||||
return htmlSafe(I18n.t(msg, { count: bootstrapModeMinUsers }));
|
|
||||||
}
|
|
||||||
|
|
||||||
@action
|
|
||||||
inviteUsers() {
|
|
||||||
showModal("create-invite");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,18 +41,6 @@ export default Controller.extend({
|
|||||||
return this.siteSettings.login_required && !this.currentUser;
|
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
|
@discourseComputed
|
||||||
showFooterNav() {
|
showFooterNav() {
|
||||||
return this.capabilities.isAppWebview || this.capabilities.isiOSPWA;
|
return this.capabilities.isAppWebview || this.capabilities.isiOSPWA;
|
||||||
|
|||||||
@ -48,9 +48,6 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
<NotificationConsentBanner />
|
<NotificationConsentBanner />
|
||||||
<PwaInstallBanner />
|
<PwaInstallBanner />
|
||||||
{{#if this.showBootstrapModeNotice}}
|
|
||||||
<BootstrapModeNotice />
|
|
||||||
{{/if}}
|
|
||||||
<GlobalNotice />
|
<GlobalNotice />
|
||||||
<CreateTopicsNotice />
|
<CreateTopicsNotice />
|
||||||
<PluginOutlet
|
<PluginOutlet
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
import { hbs } from "ember-cli-htmlbars";
|
||||||
|
import { registerWidgetShim } from "discourse/widgets/render-glimmer";
|
||||||
|
|
||||||
|
registerWidgetShim(
|
||||||
|
"header-bootstrap-mode",
|
||||||
|
"div.d-header-mode",
|
||||||
|
hbs`<BootstrapModeNotice />`
|
||||||
|
);
|
||||||
@ -14,6 +14,10 @@ createWidget("header-contents", {
|
|||||||
|
|
||||||
{{#if attrs.topic}}
|
{{#if attrs.topic}}
|
||||||
{{header-topic-info attrs=attrs}}
|
{{header-topic-info attrs=attrs}}
|
||||||
|
{{else if this.siteSettings.bootstrap_mode_enabled}}
|
||||||
|
{{#if this.currentUser.staff}}
|
||||||
|
{{header-bootstrap-mode attrs=attrs}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<div class="panel clearfix" role="navigation">{{yield}}</div>
|
<div class="panel clearfix" role="navigation">{{yield}}</div>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { test } from "qunit";
|
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) {
|
acceptance("Bootstrap Mode Notice", function (needs) {
|
||||||
needs.user({ admin: true });
|
needs.user({ admin: true });
|
||||||
@ -10,37 +10,15 @@ acceptance("Bootstrap Mode Notice", function (needs) {
|
|||||||
bootstrap_mode_min_users: 50,
|
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("/");
|
await visit("/");
|
||||||
assert.ok(
|
assert.ok(exists(".bootstrap-mode"));
|
||||||
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"
|
|
||||||
);
|
|
||||||
|
|
||||||
|
test("is hidden if bootstrap mode is disabled", async function (assert) {
|
||||||
this.siteSettings.bootstrap_mode_enabled = false;
|
this.siteSettings.bootstrap_mode_enabled = false;
|
||||||
await visit("/");
|
await visit("/");
|
||||||
await settled();
|
assert.ok(!exists(".bootstrap-mode"));
|
||||||
assert.ok(
|
|
||||||
!exists(".bootstrap-mode-notice"),
|
|
||||||
"removes the notice when bootstrap mode is disabled"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -445,3 +445,15 @@ $mobile-avatar-height: 1.532em;
|
|||||||
margin-left: 5px;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -5,11 +5,12 @@ module Jobs
|
|||||||
sidekiq_options queue: "critical"
|
sidekiq_options queue: "critical"
|
||||||
|
|
||||||
def execute(args)
|
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
|
return if SiteSetting.bootstrap_mode_enabled
|
||||||
|
|
||||||
user = User.find_by(id: args[:user_id])
|
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
|
# let's enable bootstrap mode settings
|
||||||
if SiteSetting.default_trust_level == TrustLevel[0]
|
if SiteSetting.default_trust_level == TrustLevel[0]
|
||||||
|
|||||||
@ -5,21 +5,22 @@ module Jobs
|
|||||||
every 1.day
|
every 1.day
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
return unless SiteSetting.bootstrap_mode_enabled
|
return if !SiteSetting.bootstrap_mode_enabled
|
||||||
total_users = User.human_users.count
|
|
||||||
|
|
||||||
if SiteSetting.bootstrap_mode_min_users == 0 ||
|
if SiteSetting.bootstrap_mode_min_users != 0 &&
|
||||||
total_users > SiteSetting.bootstrap_mode_min_users
|
User.human_users.count <= SiteSetting.bootstrap_mode_min_users
|
||||||
if SiteSetting.default_trust_level == TrustLevel[1]
|
return
|
||||||
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
|
||||||
|
|
||||||
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -209,12 +209,7 @@ en:
|
|||||||
message: "We've updated this site, <span>please refresh</span>, or you may experience unexpected behavior."
|
message: "We've updated this site, <span>please refresh</span>, or you may experience unexpected behavior."
|
||||||
dismiss: "Dismiss"
|
dismiss: "Dismiss"
|
||||||
|
|
||||||
bootstrap_mode_enabled:
|
bootstrap_mode: "Bootstrap mode"
|
||||||
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"
|
|
||||||
|
|
||||||
themes:
|
themes:
|
||||||
default_description: "Default"
|
default_description: "Default"
|
||||||
|
|||||||
@ -2482,6 +2482,7 @@ uncategorized:
|
|||||||
admin_quick_start_topic_id:
|
admin_quick_start_topic_id:
|
||||||
default: -1
|
default: -1
|
||||||
hidden: true
|
hidden: true
|
||||||
|
client: true
|
||||||
|
|
||||||
bootstrap_mode_min_users:
|
bootstrap_mode_min_users:
|
||||||
default: 50
|
default: 50
|
||||||
|
|||||||
@ -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!
|
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
|
### Admin Dashboard
|
||||||
|
|
||||||
Exercise your admin superpowers any time via the admin dashboard at
|
Exercise your admin superpowers any time via the admin dashboard at
|
||||||
|
|||||||
Reference in New Issue
Block a user