people: Extract emails_to_full_names_string helper.

This code that previously lived in a larger function is needed by
another function in PR #22127.
This commit is contained in:
evykassirer
2022-06-01 16:36:05 -07:00
committed by Tim Abbott
parent 6728ee1f0e
commit bc2149d1ef
3 changed files with 32 additions and 10 deletions

View File

@@ -324,16 +324,7 @@ export function format_draft(draft) {
};
} else {
const emails = util.extract_pm_recipients(draft.private_message_recipient);
const recipients = emails
.map((email) => {
email = email.trim();
const person = people.get_by_email(email);
if (person !== undefined) {
return person.full_name;
}
return email;
})
.join(", ");
const recipients = people.emails_to_full_names_string(emails);
formatted = {
draft_id: draft.id,