From 0e337c015ae8dd423b53928722b0e529ea8cb918 Mon Sep 17 00:00:00 2001 From: Priyank Patel Date: Wed, 7 Aug 2019 17:17:17 +0000 Subject: [PATCH] message_fetch: Use stream ID for stream operand. Fixes part of #9474 --- static/js/message_fetch.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/static/js/message_fetch.js b/static/js/message_fetch.js index ee621770c9..e627927bd5 100644 --- a/static/js/message_fetch.js +++ b/static/js/message_fetch.js @@ -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;