mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:47:22 +08:00
FIX: hide user notifications tab for moderator users. (#16406)
Moderators don't have access to notifications of other users. So we shouldn't display the notifications tab on other user profiles for them. Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
This commit is contained in:
parent
1898a65a13
commit
eb628b0747
|
@ -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")
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user