FIX: Incorrect message inbox displayed due to username case sensitivity (#21049)
This commit is contained in:
parent
7ae716fa69
commit
90172e5a9e
|
@ -55,12 +55,11 @@ export default class extends Controller {
|
||||||
|
|
||||||
@cached
|
@cached
|
||||||
get messagesDropdownContent() {
|
get messagesDropdownContent() {
|
||||||
|
const usernameLower = this.model.username_lower;
|
||||||
|
|
||||||
const content = [
|
const content = [
|
||||||
{
|
{
|
||||||
id: this.router.urlFor(
|
id: this.router.urlFor("userPrivateMessages.user", usernameLower),
|
||||||
"userPrivateMessages.user",
|
|
||||||
this.model.username_lower
|
|
||||||
),
|
|
||||||
name: I18n.t("user.messages.inbox"),
|
name: I18n.t("user.messages.inbox"),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -69,7 +68,7 @@ export default class extends Controller {
|
||||||
content.push({
|
content.push({
|
||||||
id: this.router.urlFor(
|
id: this.router.urlFor(
|
||||||
"userPrivateMessages.group",
|
"userPrivateMessages.group",
|
||||||
this.model.username,
|
usernameLower,
|
||||||
group.name
|
group.name
|
||||||
),
|
),
|
||||||
name: group.name,
|
name: group.name,
|
||||||
|
@ -79,10 +78,7 @@ export default class extends Controller {
|
||||||
|
|
||||||
if (this.pmTaggingEnabled) {
|
if (this.pmTaggingEnabled) {
|
||||||
content.push({
|
content.push({
|
||||||
id: this.router.urlFor(
|
id: this.router.urlFor("userPrivateMessages.tags", usernameLower),
|
||||||
"userPrivateMessages.tags",
|
|
||||||
this.model.username_lower
|
|
||||||
),
|
|
||||||
name: I18n.t("user.messages.tags"),
|
name: I18n.t("user.messages.tags"),
|
||||||
icon: "tags",
|
icon: "tags",
|
||||||
});
|
});
|
||||||
|
@ -90,7 +86,7 @@ export default class extends Controller {
|
||||||
|
|
||||||
customUserNavMessagesDropdownRows.forEach((row) => {
|
customUserNavMessagesDropdownRows.forEach((row) => {
|
||||||
content.push({
|
content.push({
|
||||||
id: this.router.urlFor(row.routeName, this.model.username_lower),
|
id: this.router.urlFor(row.routeName, usernameLower),
|
||||||
name: row.name,
|
name: row.name,
|
||||||
icon: row.icon,
|
icon: row.icon,
|
||||||
});
|
});
|
||||||
|
|
|
@ -954,12 +954,28 @@ acceptance(
|
||||||
acceptance(
|
acceptance(
|
||||||
"User Private Messages - user with uppercase username",
|
"User Private Messages - user with uppercase username",
|
||||||
function (needs) {
|
function (needs) {
|
||||||
needs.user();
|
needs.user({
|
||||||
|
groups: [{ id: 14, name: "awesome_group", has_messages: true }],
|
||||||
|
});
|
||||||
|
|
||||||
needs.pretender((server, helper) => {
|
needs.pretender((server, helper) => {
|
||||||
const response = cloneJSON(userFixtures["/u/charlie.json"]);
|
const response = cloneJSON(userFixtures["/u/charlie.json"]);
|
||||||
response.user.username = "chArLIe";
|
response.user.username = "chArLIe";
|
||||||
server.get("/u/charlie.json", () => helper.response(response));
|
server.get("/u/charlie.json", () => helper.response(response));
|
||||||
|
|
||||||
|
server.get(
|
||||||
|
"/topics/private-messages-group/:username/:group_name.json",
|
||||||
|
() => {
|
||||||
|
return helper.response({
|
||||||
|
topic_list: {
|
||||||
|
topics: [
|
||||||
|
{ id: 1, posters: [] },
|
||||||
|
{ id: 2, posters: [] },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("viewing inbox", async function (assert) {
|
test("viewing inbox", async function (assert) {
|
||||||
|
@ -971,5 +987,15 @@ acceptance(
|
||||||
"menu defaults to Inbox"
|
"menu defaults to Inbox"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("viewing group inbox", async function (assert) {
|
||||||
|
await visit("/u/charlie/messages/group/awesome_group");
|
||||||
|
|
||||||
|
assert.strictEqual(
|
||||||
|
query(".user-nav-messages-dropdown .selected-name").textContent.trim(),
|
||||||
|
"awesome_group",
|
||||||
|
"dropdown menu displays the right group name"
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue