mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
people: Refactor out user id string to array function.
This commit is contained in:
committed by
Tim Abbott
parent
3b502fa235
commit
5228403eb5
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user