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.
This commit is contained in:
Varun Singh 2024-02-02 22:10:38 +05:30 committed by Tim Abbott
parent fc86aca769
commit f0b8cc7865
1 changed files with 5 additions and 3 deletions

View File

@ -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,