diff --git a/frontend_tests/node_tests/people.js b/frontend_tests/node_tests/people.js index 9fcdd0f1b0..3096684ef0 100644 --- a/frontend_tests/node_tests/people.js +++ b/frontend_tests/node_tests/people.js @@ -401,9 +401,9 @@ test_people("get_recipients", () => { assert.equal(people.get_recipients("30,32"), "Isaac Newton"); }); -test_people("safe_full_names", () => { +test_people("get_full_names_for_poll_option", () => { people.add_active_user(isaac); - const names = people.safe_full_names([me.user_id, isaac.user_id]); + const names = people.get_full_names_for_poll_option([me.user_id, isaac.user_id]); assert.equal(names, "Me Myself, Isaac Newton"); }); diff --git a/frontend_tests/node_tests/poll_widget.js b/frontend_tests/node_tests/poll_widget.js index e43c525d77..249df0661a 100644 --- a/frontend_tests/node_tests/poll_widget.js +++ b/frontend_tests/node_tests/poll_widget.js @@ -39,7 +39,7 @@ run_test("PollData my question", () => { is_my_poll, question, options: [], - comma_separated_names: people.safe_full_names, + comma_separated_names: people.get_full_names_for_poll_option, report_error_function: blueslip.warn, }); diff --git a/static/js/people.js b/static/js/people.js index 34db7a3275..d355ccec3d 100644 --- a/static/js/people.js +++ b/static/js/people.js @@ -298,15 +298,8 @@ export function email_list_to_user_ids_string(emails) { return user_ids.join(","); } -export function safe_full_names(user_ids) { - let names = user_ids.map((user_id) => { - const person = people_by_user_id_dict.get(user_id); - return person && person.full_name; - }); - - names = names.filter(Boolean); - - return names.join(", "); +export function get_full_names_for_poll_option(user_ids) { + return get_display_full_names(user_ids).join(", "); } export function get_display_full_names(user_ids) { diff --git a/static/js/poll_widget.js b/static/js/poll_widget.js index 8f5cc4d9a5..b7005c8b33 100644 --- a/static/js/poll_widget.js +++ b/static/js/poll_widget.js @@ -19,7 +19,7 @@ export function activate({ is_my_poll, question, options, - comma_separated_names: people.safe_full_names, + comma_separated_names: people.get_full_names_for_poll_option, report_error_function: blueslip.warn, });