Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
filter: Return false for invalid filters.
Aman Agrawal0267ba54b286
diff --git a/frontend_tests/node_tests/filter.js b/frontend_tests/node_tests/filter.jsindex 217a30aa1dc..eae5d0a8c31 100644--- a/frontend_tests/node_tests/filter.js+++ b/frontend_tests/node_tests/filter.js@@ -832,13 +832,13 @@ test("predicate_edge_cases", () => {// invalid operator/operand combinations, but right now we just silently// return a function that accepts all messages.predicate = get_predicate([["in", "bogus"]]);- assert(predicate({}));+ assert(!predicate({}));predicate = get_predicate([["bogus", 33]]);assert(predicate({}));predicate = get_predicate([["is", "bogus"]]);- assert(predicate({}));+ assert(!predicate({}));// Exercise caching feature.const stream_id = 101;diff --git a/static/js/filter.js b/static/js/filter.jsindex aea3631c545..8451e630051 100644--- a/static/js/filter.js+++ b/static/js/filter.js@@ -89,7 +89,7 @@ function message_matches_search_term(message, operator, operand) {} else if (operand === "unread") {return unread.message_unread(message);}- return true; // is:whatever returns true+ return false; // is:whatever returns falsecase "in":if (operand === "home") {@@ -97,7 +97,7 @@ function message_matches_search_term(message, operator, operand) {} else if (operand === "all") {return true;}- return true; // in:whatever returns true+ return false; // in:whatever returns falsecase "near":// this is all handled server side