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

Earlier in drafts overlay, the order of pm recipients for the draft
was sorted differently to that of the pm group title.

This commit fixes the behaviour by sorting the drafts pm recipients
using `make_strcmp`.

Fixes part of zulip#27375.

Co-authored-by: richardshaju <richardshaju66@gmail.com>
This commit is contained in:
Pratik Chanda
2024-05-22 18:26:57 +05:30
committed by Tim Abbott
parent eeae434625
commit c180b25a68
3 changed files with 13 additions and 12 deletions

View File

@@ -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 {