people: Extract _calc_user_and_other_ids from get_recipients.

We previously added support for showing the status_emoji to the PM
list, but we only supported individual PMs and not group PMs, this is
prep commit towards supporting group PMs.
This commit is contained in:
YashRE42 2022-03-19 21:19:06 +05:30 committed by Tim Abbott
parent 72cf5bd90d
commit 7e03ed9391
1 changed files with 7 additions and 2 deletions

View File

@ -328,11 +328,16 @@ export function get_full_name(user_id) {
return people_by_user_id_dict.get(user_id).full_name; return people_by_user_id_dict.get(user_id).full_name;
} }
function _calc_user_and_other_ids(user_ids_string) {
const user_ids = split_to_ints(user_ids_string);
const other_ids = user_ids.filter((user_id) => !is_my_user_id(user_id));
return {user_ids, other_ids};
}
export function get_recipients(user_ids_string) { export function get_recipients(user_ids_string) {
// See message_store.get_pm_full_names() for a similar function. // See message_store.get_pm_full_names() for a similar function.
const user_ids = split_to_ints(user_ids_string); const {other_ids} = _calc_user_and_other_ids(user_ids_string);
const other_ids = user_ids.filter((user_id) => !is_my_user_id(user_id));
if (other_ids.length === 0) { if (other_ids.length === 0) {
// private message with oneself // private message with oneself