people: Refactor out user id string to array function.

This commit is contained in:
Priyank Patel
2019-06-06 19:49:01 +00:00
committed by Tim Abbott
parent 3b502fa235
commit 5228403eb5
2 changed files with 9 additions and 6 deletions

View File

@@ -185,12 +185,7 @@ function create_message_object() {
// automatically created when you try to send a private
// message to their email address.
if (message.to_user_ids !== undefined) {
// to_user_ids is a string containing a comma-separated
// list of user IDs for the recipients; convert this into
// an array of integers.
message.to = _.map(message.to_user_ids.split(','), function (id) {
return Number(id);
});
message.to = people.user_ids_string_to_ids_array(message.to_user_ids);
}
} else {

View File

@@ -180,6 +180,14 @@ exports.user_ids_string_to_emails_string = function (user_ids_string) {
return emails.join(',');
};
exports.user_ids_string_to_ids_array = function (user_ids_string) {
var user_ids = user_ids_string.split(',');
var ids = _.map(user_ids, function (id) {
return Number(id);
});
return ids;
};
exports.reply_to_to_user_ids_string = function (emails_string) {
// This is basically emails_strings_to_user_ids_string
// without blueslip warnings, since it can be called with