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.

narrow-filter: Update `Filter.describe_is_operator` for "resolved".

Lauryn Menardb821c90f4464
diff --git a/web/src/filter.js b/web/src/filter.js
index 64b7ec37dd8..a33a7fb7c53 100644
--- a/web/src/filter.js
+++ b/web/src/filter.js
@@ -999,14 +999,20 @@ export class Filter {
static describe_is_operator(operator) {
const verb = operator.negated ? "exclude " : "";
const operand = operator.operand;
- const operand_list = ["starred", "alerted", "unread"];
- if (operand_list.includes(operand)) {
- return verb + operand + " messages";
- } else if (operand === "mentioned") {
- return verb + "@-mentions";
- } else if (operand === "private") {
- return verb + "direct messages";
+
+ switch (operand) {
+ case "starred":
+ case "alerted":
+ case "unread":
+ return verb + operand + " messages";
+ case "mentioned":
+ return verb + "@-mentions";
+ case "private":
+ return verb + "direct messages";
+ case "resolved":
+ return verb + "topics marked as resolved";
}
+
return "invalid " + operand + " operand for is operator";
}
diff --git a/web/tests/filter.test.js b/web/tests/filter.test.js
index 132152c20bc..4417a566d8f 100644
--- a/web/tests/filter.test.js
+++ b/web/tests/filter.test.js
@@ -1157,6 +1157,10 @@ test("describe", () => {
string = "alerted messages";
assert.equal(Filter.describe(narrow), string);
+ narrow = [{operator: "is", operand: "resolved"}];
+ string = "topics marked as resolved";
+ assert.equal(Filter.describe(narrow), string);
+
narrow = [{operator: "is", operand: "something_we_do_not_support"}];
string = "invalid something_we_do_not_support operand for is operator";
assert.equal(Filter.describe(narrow), string);