diff --git a/app/assets/javascripts/discourse/app/controllers/user.js b/app/assets/javascripts/discourse/app/controllers/user.js index 1519e04e82..2efaf9724c 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 1485f8223a..9d522d3d93 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) {