Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

filter: Add near operation to operators allowing collapsing.

Tim Abbottd915a13d617e
diff --git a/frontend_tests/node_tests/filter.js b/frontend_tests/node_tests/filter.js
index 1cf758884a0..0ae7406f96a 100644
--- a/frontend_tests/node_tests/filter.js
+++ b/frontend_tests/node_tests/filter.js
@@ -111,6 +111,23 @@ test("basics", () => {
assert.ok(filter.can_bucket_by("stream"));
assert.ok(filter.can_bucket_by("stream", "topic"));
+ operators = [
+ {operator: "stream", operand: "foo"},
+ {operator: "topic", operand: "bar"},
+ {operator: "near", operand: 17},
+ ];
+ filter = new Filter(operators);
+
+ assert.ok(!filter.is_search());
+ assert.ok(!filter.can_mark_messages_read());
+ assert.ok(filter.supports_collapsing_recipients());
+ assert.ok(!filter.contains_only_private_messages());
+ assert.ok(!filter.allow_use_first_unread_when_narrowing());
+ assert.ok(filter.can_apply_locally());
+ assert.ok(!filter.is_personal_filter());
+ assert.ok(filter.can_bucket_by("stream"));
+ assert.ok(filter.can_bucket_by("stream", "topic"));
+
// If our only stream operator is negated, then for all intents and purposes,
// we don't consider ourselves to have a stream operator, because we don't
// want to have the stream in the tab bar or unsubscribe messaging, etc.
diff --git a/static/js/filter.js b/static/js/filter.js
index 6639688e27b..178d1524304 100644
--- a/static/js/filter.js
+++ b/static/js/filter.js
@@ -467,6 +467,7 @@ export class Filter {
"not-streams-public",
"streams-web-public",
"not-streams-web-public",
+ "near",
]);
for (const term of term_types) {