message_fetch: Use user ID for sender and group-pm-with operator.

This commit is contained in:
Priyank Patel 2019-07-13 00:16:35 +00:00 committed by Tim Abbott
parent b338fd130e
commit ea2e7ccf27
1 changed files with 8 additions and 0 deletions

View File

@ -110,6 +110,7 @@ function get_messages_success(data, opts) {
// because doing so breaks the app in various modules that expect emails string.
function handle_user_ids_supported_operators(data) {
var user_ids_supported_operators = ['pm-with'];
var user_id_supported_operators = ['sender', 'group-pm-with'];
if (data.narrow === undefined) {
return data;
@ -121,6 +122,13 @@ function handle_user_ids_supported_operators(data) {
filter.operand = people.emails_strings_to_user_ids_array(filter.operand);
}
if (user_id_supported_operators.indexOf(filter.operator) !== -1) {
var person = people.get_by_email(filter.operand);
if (person !== undefined) {
filter.operand = person.user_id;
}
}
return filter;
});