mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
message_events: Don't accept undefined filter in filter_has_term_type.
Accepting an undefined Filter has no advantage; every caller either passes a defined Filter or has to later check for undefined anyway.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user