UX: Differentiate 'emails disabled' notice for 'yes' and 'non-staff' (#16096)

This commit is contained in:
David Taylor 2022-03-03 15:49:20 +00:00 committed by GitHub
parent 567be512c9
commit a7db0ce985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 1 deletions

View File

@ -121,13 +121,20 @@ export default Component.extend({
);
}
if (disableEmails === "yes" || disableEmails === "non-staff") {
if (disableEmails === "yes") {
notices.push(
Notice.create({
text: I18n.t("emails_are_disabled"),
id: "alert-emails-disabled",
})
);
} else if (disableEmails === "non-staff") {
notices.push(
Notice.create({
text: I18n.t("emails_are_disabled_non_staff"),
id: "alert-emails-disabled",
})
);
}
if (wizardRequired) {

View File

@ -1,10 +1,12 @@
import {
acceptance,
exists,
query,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
import { visit } from "@ember/test-helpers";
import I18n from "I18n";
acceptance("Email Disabled Banner", function (needs) {
needs.user();
@ -25,6 +27,11 @@ acceptance("Email Disabled Banner", function (needs) {
exists(".alert-emails-disabled"),
"alert is displayed when email disabled"
);
assert.strictEqual(
query(".alert-emails-disabled").innerText,
I18n.t("emails_are_disabled"),
"alert uses the correct text"
);
});
test("when non-staff", async function (assert) {
@ -34,6 +41,11 @@ acceptance("Email Disabled Banner", function (needs) {
exists(".alert-emails-disabled"),
"alert is displayed when email disabled for non-staff"
);
assert.strictEqual(
query(".alert-emails-disabled").innerText,
I18n.t("emails_are_disabled_non_staff"),
"alert uses the correct text"
);
updateCurrentUser({ moderator: true });
await visit("/");
@ -41,5 +53,10 @@ acceptance("Email Disabled Banner", function (needs) {
exists(".alert-emails-disabled"),
"alert is displayed to staff when email disabled for non-staff"
);
assert.strictEqual(
query(".alert-emails-disabled").innerText,
I18n.t("emails_are_disabled_non_staff"),
"alert uses the correct text"
);
});
});

View File

@ -182,6 +182,7 @@ en:
wizard_required: "Welcome to your new Discourse! Lets get started with <a href='%{url}' data-auto-route='true'>the setup wizard</a> ✨"
emails_are_disabled: "All outgoing email has been globally disabled by an administrator. No email notifications of any kind will be sent."
emails_are_disabled_non_staff: "Outgoing email has been disabled for non-staff users."
software_update_prompt:
message: "We've updated this site, <span>please refresh</span>, or you may experience unexpected behavior."