diff --git a/web/src/message_events.js b/web/src/message_events.js index f61944fa64..fe3329932a 100644 --- a/web/src/message_events.js +++ b/web/src/message_events.js @@ -41,9 +41,8 @@ import * as util from "./util.ts"; function filter_has_term_type(filter, term_type) { return ( - filter !== undefined && - (filter.sorted_term_types().includes(term_type) || - filter.sorted_term_types().includes(`not-${term_type}`)) + filter.sorted_term_types().includes(term_type) || + filter.sorted_term_types().includes(`not-${term_type}`) ); } @@ -81,7 +80,7 @@ export function update_current_view_for_topic_visibility() { // is easier to just load the narrow from scratch, instead of asking server // for relevant messages in the updated topic. const filter = message_lists.current?.data.filter; - if (filter_has_term_type(filter, "is-followed")) { + if (filter !== undefined && filter_has_term_type(filter, "is-followed")) { // Use `set_timeout to call after we update the topic // visibility policy locally. // Calling this outside `user_topics_ui` to avoid circular imports.