mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 11:32:46 +08:00
FIX: Consolidated like notifications links to wrong user on user page.
This commit is contained in:
parent
27e2b6575b
commit
f8db93df5f
|
@ -64,9 +64,11 @@ createWidget("notification-item", {
|
|||
|
||||
if (attrs.notification_type === LIKED_CONSOLIDATED_TYPE) {
|
||||
return userPath(
|
||||
`${
|
||||
this.currentUser.username
|
||||
}/notifications/likes-received?acting_username=${data.display_username}`
|
||||
`${this.attrs.username ||
|
||||
this.currentUser
|
||||
.username}/notifications/likes-received?acting_username=${
|
||||
data.display_username
|
||||
}`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,11 @@ createWidget("large-notification-item", {
|
|||
export default createWidget("user-notifications-large", {
|
||||
html(attrs) {
|
||||
const notifications = attrs.notifications;
|
||||
return notifications.map(n => this.attach("large-notification-item", n));
|
||||
const username = notifications.findArgs.username;
|
||||
|
||||
return notifications.map(n => {
|
||||
n.username = username;
|
||||
return this.attach("large-notification-item", n);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -15,6 +15,16 @@ QUnit.test("Messages", async assert => {
|
|||
QUnit.test("Notifications", async assert => {
|
||||
await visit("/u/eviltrout/notifications");
|
||||
assert.ok($("body.user-notifications-page").length, "has the body class");
|
||||
|
||||
await visit("/u/test/notifications");
|
||||
|
||||
const $links = find(".item.notification a");
|
||||
|
||||
assert.ok(
|
||||
$links[1].href.includes(
|
||||
"/u/test/notifications/likes-received?acting_username=aquaman"
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Root URL - Viewing Self", async assert => {
|
||||
|
|
|
@ -79,6 +79,12 @@ export default function() {
|
|||
return response(json);
|
||||
});
|
||||
|
||||
this.get("/u/test.json", () => {
|
||||
const json = fixturesByUrl["/u/eviltrout.json"];
|
||||
json.user.username = "test";
|
||||
return response(json);
|
||||
});
|
||||
|
||||
this.get("/u/eviltrout/summary.json", () => {
|
||||
return response({
|
||||
user_summary: {
|
||||
|
|
Loading…
Reference in New Issue
Block a user