From f0b8cc78655b2cdee9fa5b10e091895c08b425da Mon Sep 17 00:00:00 2001 From: Varun Singh Date: Fri, 2 Feb 2024 22:10:38 +0530 Subject: [PATCH] scheduled_messages_feed_ui: Refactor to avoid duplicate function calls. While this logic might seem to be different, util.same_stream_and_topic would always return false when passed a topic of undefined. --- web/src/scheduled_messages_feed_ui.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/src/scheduled_messages_feed_ui.js b/web/src/scheduled_messages_feed_ui.js index 2ef8524eeb..d7e9a8fdb2 100644 --- a/web/src/scheduled_messages_feed_ui.js +++ b/web/src/scheduled_messages_feed_ui.js @@ -33,12 +33,14 @@ function get_scheduled_messages_matching_narrow() { return true; } } else if (scheduled_message.type === "stream") { - if (narrow_state.stream_sub() === undefined) { + const current_stream = narrow_state.stream_sub(); + const current_topic = narrow_state.topic(); + if (current_stream === undefined || current_topic === undefined) { return false; } const narrow_dict = { - stream_id: narrow_state.stream_sub().stream_id, - topic: narrow_state.topic(), + stream_id: current_stream.stream_id, + topic: current_topic, }; const scheduled_message_dict = { stream_id: scheduled_message.to,