mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 11:44:00 +08:00
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
|
||||
get messagesDropdownContent() {
|
||||
const usernameLower = this.model.username_lower;
|
||||
|
||||
const content = [
|
||||
{
|
||||
id: this.router.urlFor(
|
||||
"userPrivateMessages.user",
|
||||
this.model.username_lower
|
||||
),
|
||||
id: this.router.urlFor("userPrivateMessages.user", usernameLower),
|
||||
name: I18n.t("user.messages.inbox"),
|
||||
},
|
||||
];
|
||||
|
@ -69,7 +68,7 @@ export default class extends Controller {
|
|||
content.push({
|
||||
id: this.router.urlFor(
|
||||
"userPrivateMessages.group",
|
||||
this.model.username,
|
||||
usernameLower,
|
||||
group.name
|
||||
),
|
||||
name: group.name,
|
||||
|
@ -79,10 +78,7 @@ export default class extends Controller {
|
|||
|
||||
if (this.pmTaggingEnabled) {
|
||||
content.push({
|
||||
id: this.router.urlFor(
|
||||
"userPrivateMessages.tags",
|
||||
this.model.username_lower
|
||||
),
|
||||
id: this.router.urlFor("userPrivateMessages.tags", usernameLower),
|
||||
name: I18n.t("user.messages.tags"),
|
||||
icon: "tags",
|
||||
});
|
||||
|
@ -90,7 +86,7 @@ export default class extends Controller {
|
|||
|
||||
customUserNavMessagesDropdownRows.forEach((row) => {
|
||||
content.push({
|
||||
id: this.router.urlFor(row.routeName, this.model.username_lower),
|
||||
id: this.router.urlFor(row.routeName, usernameLower),
|
||||
name: row.name,
|
||||
icon: row.icon,
|
||||
});
|
||||
|
|
|
@ -954,12 +954,28 @@ acceptance(
|
|||
acceptance(
|
||||
"User Private Messages - user with uppercase username",
|
||||
function (needs) {
|
||||
needs.user();
|
||||
needs.user({
|
||||
groups: [{ id: 14, name: "awesome_group", has_messages: true }],
|
||||
});
|
||||
|
||||
needs.pretender((server, helper) => {
|
||||
const response = cloneJSON(userFixtures["/u/charlie.json"]);
|
||||
response.user.username = "chArLIe";
|
||||
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) {
|
||||
|
@ -971,5 +987,15 @@ acceptance(
|
|||
"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
Block a user