Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

drafts: Fix order of group pm recipients in draft overlay.

Pratik Chandac180b25a683c
diff --git a/web/e2e-tests/drafts.test.ts b/web/e2e-tests/drafts.test.ts
index 473732bca67..aa431e7e298 100644
--- a/web/e2e-tests/drafts.test.ts
+++ b/web/e2e-tests/drafts.test.ts
@@ -131,7 +131,7 @@ async function test_previously_created_drafts_rendered(page: Page): Promise<void
page,
"#drafts_table .overlay-message-row .message_header_private_message .stream_label",
),
- "You and King Hamlet, Cordelia, Lear's daughter",
+ "You and Cordelia, Lear's daughter, King Hamlet",
);
assert.strictEqual(
await common.get_text_from_selector(
diff --git a/web/src/people.ts b/web/src/people.ts
index f6ad43a33af..5740aac56ca 100644
--- a/web/src/people.ts
+++ b/web/src/people.ts
@@ -324,16 +324,17 @@ export function reply_to_to_user_ids_string(emails_string: string): string | und
}
export function emails_to_full_names_string(emails: string[]): string {
- return emails
- .map((email) => {
- email = email.trim();
- const person = get_by_email(email);
- if (person !== undefined) {
- return person.full_name;
- }
- return INACCESSIBLE_USER_NAME;
- })
- .join(", ");
+ const names = emails.map((email) => {
+ email = email.trim();
+ const person = get_by_email(email);
+ if (person !== undefined) {
+ return person.full_name;
+ }
+ return INACCESSIBLE_USER_NAME;
+ });
+
+ const sorted_names = names.sort(util.make_strcmp());
+ return sorted_names.join(", ");
}
export function get_user_time(user_id: number): string | undefined {
diff --git a/web/tests/people.test.js b/web/tests/people.test.js
index 6df410b2905..5f95d02914b 100644
--- a/web/tests/people.test.js
+++ b/web/tests/people.test.js
@@ -852,7 +852,7 @@ test_people("emails_to_full_names_string", () => {
maria.email,
]),
- `${charles.full_name}, translated: Unknown user, ${maria.full_name}`,
+ `${charles.full_name}, ${maria.full_name}, translated: Unknown user`,
);
});