pm_list: Use "Muted user" placeholder for muted usernames.

This also handles a few other places missed earlier like
narrow headings, beacuse they use the same function.

We already rerender the PM list for events, so there's no
need to do anything special when someone is muted/unmuted.

`people.get_full_names` is now only used in the settings pages
while creating ListWidgets etc, so we add a new test for
it to ensure coverage.
This commit is contained in:
Abhijeet Prasad Bodas
2021-05-13 13:02:06 +05:30
committed by Tim Abbott
parent 49e076e01c
commit a377a2df8b
2 changed files with 11 additions and 1 deletions

View File

@@ -397,8 +397,18 @@ test_people("pm_lookup_key", () => {
test_people("get_recipients", () => { test_people("get_recipients", () => {
people.add_active_user(isaac); people.add_active_user(isaac);
people.add_active_user(linus);
assert.equal(people.get_recipients("30"), "Me Myself"); assert.equal(people.get_recipients("30"), "Me Myself");
assert.equal(people.get_recipients("30,32"), "Isaac Newton"); assert.equal(people.get_recipients("30,32"), "Isaac Newton");
muting.add_muted_user(304);
assert.equal(people.get_recipients("304,32"), "Isaac Newton, translated: Muted user");
});
test_people("get_full_name", () => {
people.add_active_user(isaac);
const names = people.get_full_name(isaac.user_id);
assert.equal(names, "Isaac Newton");
}); });
test_people("get_full_names_for_poll_option", () => { test_people("get_full_names_for_poll_option", () => {

View File

@@ -333,7 +333,7 @@ export function get_recipients(user_ids_string) {
return my_full_name(); return my_full_name();
} }
const names = other_ids.map((user_id) => get_full_name(user_id)).sort(); const names = get_display_full_names(other_ids).sort();
return names.join(", "); return names.join(", ");
} }