FIX: Show 'emails disabled' to staff users when disabled for non-staff (#7187)

This commit is contained in:
David Taylor 2019-03-18 15:26:18 +00:00 committed by Régis Hanol
parent 2347661a74
commit acc121fd27
2 changed files with 29 additions and 2 deletions

View File

@ -25,8 +25,7 @@ export default Ember.Component.extend(
if (
this.siteSettings.disable_emails === "yes" ||
(this.siteSettings.disable_emails === "non-staff" &&
!(this.currentUser && this.currentUser.get("staff")))
this.siteSettings.disable_emails === "non-staff"
) {
notices.push([I18n.t("emails_are_disabled"), "alert-emails-disabled"]);
}

View File

@ -0,0 +1,28 @@
import { acceptance } from "helpers/qunit-helpers";
acceptance("Email Disabled Banner", {
loggedIn: true
});
QUnit.test("shows banner when required", async assert => {
Discourse.SiteSettings.disable_email = "no";
await visit("/");
assert.notOk(
exists(".alert-emails-disabled"),
"alert is not displayed when email enabled"
);
Discourse.SiteSettings.disable_email = "yes";
await visit("/");
assert.notOk(
exists(".alert-emails-disabled"),
"alert is displayed when email disabled"
);
Discourse.SiteSettings.disable_email = "non-staff";
await visit("/");
assert.notOk(
exists(".alert-emails-disabled"),
"alert is displayed when email disabled for non-staff"
);
});