mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 23:24:10 +08:00
FIX: Consolidated like notifications links to wrong user on user page.
This commit is contained in:
@ -64,9 +64,11 @@ createWidget("notification-item", {
|
|||||||
|
|
||||||
if (attrs.notification_type === LIKED_CONSOLIDATED_TYPE) {
|
if (attrs.notification_type === LIKED_CONSOLIDATED_TYPE) {
|
||||||
return userPath(
|
return userPath(
|
||||||
`${
|
`${this.attrs.username ||
|
||||||
this.currentUser.username
|
this.currentUser
|
||||||
}/notifications/likes-received?acting_username=${data.display_username}`
|
.username}/notifications/likes-received?acting_username=${
|
||||||
|
data.display_username
|
||||||
|
}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,11 @@ createWidget("large-notification-item", {
|
|||||||
export default createWidget("user-notifications-large", {
|
export default createWidget("user-notifications-large", {
|
||||||
html(attrs) {
|
html(attrs) {
|
||||||
const notifications = attrs.notifications;
|
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 => {
|
QUnit.test("Notifications", async assert => {
|
||||||
await visit("/u/eviltrout/notifications");
|
await visit("/u/eviltrout/notifications");
|
||||||
assert.ok($("body.user-notifications-page").length, "has the body class");
|
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 => {
|
QUnit.test("Root URL - Viewing Self", async assert => {
|
||||||
|
@ -79,6 +79,12 @@ export default function() {
|
|||||||
return response(json);
|
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", () => {
|
this.get("/u/eviltrout/summary.json", () => {
|
||||||
return response({
|
return response({
|
||||||
user_summary: {
|
user_summary: {
|
||||||
|
Reference in New Issue
Block a user