Skip to content

A platform for community discussion. Free, open, simple.

FIX: hide user notifications tab for moderator users. (#16406)

Vinoth Kannaneb628b074711
diff --git a/app/assets/javascripts/discourse/app/controllers/user.js b/app/assets/javascripts/discourse/app/controllers/user.js
index 1519e04e82a..2efaf9724ce 100644
--- a/app/assets/javascripts/discourse/app/controllers/user.js
+++ b/app/assets/javascripts/discourse/app/controllers/user.js
@@ -116,9 +116,9 @@ export default Controller.extend(CanCheckEmails, {
);
},
- @discourseComputed("viewingSelf", "currentUser.staff")
- showNotificationsTab(viewingSelf, staff) {
- return viewingSelf || staff;
+ @discourseComputed("viewingSelf", "currentUser.admin")
+ showNotificationsTab(viewingSelf, isAdmin) {
+ return viewingSelf || isAdmin;
},
@discourseComputed("model.name")
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-test.js
index 1485f8223a0..9d522d3d939 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-test.js
@@ -8,6 +8,7 @@ import {
exists,
query,
queryAll,
+ updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
import { click, currentRouteName, visit } from "@ember/test-helpers";
import { cloneJSON } from "discourse-common/lib/object";
@@ -55,6 +56,20 @@ acceptance("User Routes", function (needs) {
"/u/eviltrout/notifications/likes-received?acting_username=aquaman"
)
);
+
+ updateCurrentUser({ moderator: true, admin: false });
+ await visit("/u/charlie/summary");
+ assert.notOk(
+ exists(".user-nav > .user-notifications"),
+ "does not have the notifications tab"
+ );
+
+ updateCurrentUser({ moderator: false, admin: true });
+ await visit("/u/charlie/summary");
+ assert.ok(
+ exists(".user-nav > .user-notifications"),
+ "has the notifications tab"
+ );
});
test("Root URL - Viewing Self", async function (assert) {