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.

recent_view_search: Add support to search for empty string topics.

Prakhar Pratyush8a1b1590ad83
diff --git a/web/src/recent_view_ui.ts b/web/src/recent_view_ui.ts
index de1ee3ec344..b7c3320ad9b 100644
--- a/web/src/recent_view_ui.ts
+++ b/web/src/recent_view_ui.ts
@@ -804,7 +804,8 @@ export function topic_in_search_results(
if (keyword === "") {
return true;
}
- const text = (stream_name + " " + topic).toLowerCase();
+ const topic_display_name = util.get_final_topic_display_name(topic);
+ const text = (stream_name + " " + topic_display_name).toLowerCase();
return typeahead.query_matches_string_in_any_order(keyword, text, " ");
}
diff --git a/web/tests/recent_view.test.cjs b/web/tests/recent_view.test.cjs
index 22c64363c3d..2f1f8d60da3 100644
--- a/web/tests/recent_view.test.cjs
+++ b/web/tests/recent_view.test.cjs
@@ -1166,5 +1166,6 @@ test("test_search", () => {
assert.equal(rt.topic_in_search_results("\\", "general", "\\"), true);
assert.equal(rt.topic_in_search_results("\\", "general", "\\\\"), true);
- // TODO: Add a test for empty topic name after CZO discussion.
+ // Test for empty string topic name.
+ assert.equal(rt.topic_in_search_results("general chat", "Scotland", ""), true);
});