DEV: Correct email disabled banner tests

DEV: Correct email disabled banner tests

Followup to acc121fd27e53fb70c888b58939027fbefba9c6f

diff --git a/app/assets/javascripts/discourse/components/global-notice.js.es6 b/app/assets/javascripts/discourse/components/global-notice.js.es6
index e59fb08..8512335 100644
--- a/app/assets/javascripts/discourse/components/global-notice.js.es6
+++ b/app/assets/javascripts/discourse/components/global-notice.js.es6
@@ -5,7 +5,7 @@ import { bufferedRender } from "discourse-common/lib/buffered-render";
 
 export default Ember.Component.extend(
   bufferedRender({
-    rerenderTriggers: ["site.isReadOnly"],
+    rerenderTriggers: ["site.isReadOnly", "siteSettings.disable_emails"],
 
     buildBuffer(buffer) {
       let notices = [];
diff --git a/test/javascripts/acceptance/email-notice-test.js.es6 b/test/javascripts/acceptance/email-notice-test.js.es6
index be496da..0286926 100644
--- a/test/javascripts/acceptance/email-notice-test.js.es6
+++ b/test/javascripts/acceptance/email-notice-test.js.es6
@@ -1,28 +1,35 @@
-import { acceptance } from "helpers/qunit-helpers";
+import { acceptance, replaceCurrentUser } from "helpers/qunit-helpers";
 
 acceptance("Email Disabled Banner", {
   loggedIn: true
 });
 
 QUnit.test("shows banner when required", async assert => {
-  Discourse.SiteSettings.disable_email = "no";
+  Discourse.set("SiteSettings.disable_emails", "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(
+  Discourse.set("SiteSettings.disable_emails", "yes");
+  await visit("/latest");
+  assert.ok(
     exists(".alert-emails-disabled"),
     "alert is displayed when email disabled"
   );
 
-  Discourse.SiteSettings.disable_email = "non-staff";
+  Discourse.set("SiteSettings.disable_emails", "non-staff");
   await visit("/");
-  assert.notOk(
+  assert.ok(
     exists(".alert-emails-disabled"),
     "alert is displayed when email disabled for non-staff"
   );
+
+  replaceCurrentUser({ staff: true, moderator: true });
+  await visit("/");
+  assert.ok(
+    exists(".alert-emails-disabled"),
+    "alert is displayed to staff when email disabled for non-staff"
+  );
 });

GitHub sha: e2d6edd5

1 Like