message_fetch: Use stream ID for stream operand.

Fixes part of #9474
This commit is contained in:
Priyank Patel 2019-08-07 17:17:17 +00:00 committed by Tim Abbott
parent 3680393b47
commit 0e337c015a
1 changed files with 11 additions and 1 deletions

View File

@ -110,7 +110,7 @@ function get_messages_success(data, opts) {
// because doing so breaks the app in various modules that expect emails string.
function handle_operators_supporting_id_based_api(data) {
var operators_supporting_ids = ['pm-with'];
var operators_supporting_id = ['sender', 'group-pm-with'];
var operators_supporting_id = ['sender', 'group-pm-with', 'stream'];
if (data.narrow === undefined) {
return data;
@ -123,6 +123,16 @@ function handle_operators_supporting_id_based_api(data) {
}
if (operators_supporting_id.indexOf(filter.operator) !== -1) {
if (filter.operator === 'stream') {
const stream_id = stream_data.get_stream_id(filter.operand);
if (stream_id !== undefined) {
filter.operand = stream_id;
}
return filter;
}
// The other operands supporting object IDs all work with user objects.
var person = people.get_by_email(filter.operand);
if (person !== undefined) {
filter.operand = person.user_id;