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_banner: Show capitalized stop words as excluded from search.

Shubham Padia703350aa8be8
diff --git a/web/src/narrow_banner.ts b/web/src/narrow_banner.ts
index 8903ecf6224..7583507de4f 100644
--- a/web/src/narrow_banner.ts
+++ b/web/src/narrow_banner.ts
@@ -130,7 +130,7 @@ function empty_search_query_banner(
// Gather information about each query word
for (const query_word of query_words) {
- if (realm.stop_words.includes(query_word)) {
+ if (realm.stop_words.includes(query_word.toLowerCase())) {
search_string_result.has_stop_word = true;
search_string_result.query_words.push({
query_word,
diff --git a/web/tests/message_view.test.cjs b/web/tests/message_view.test.cjs
index 79bad0f0ae4..50e388ad0e6 100644
--- a/web/tests/message_view.test.cjs
+++ b/web/tests/message_view.test.cjs
@@ -891,6 +891,30 @@ run_test("show_search_stopwords", ({mock_template, override}) => {
expected_search_data,
),
);
+
+ // Stop word exclusion is case insensitive.
+ const expected_search_data_capitalization_case = {
+ has_stop_word: true,
+ query_words: [
+ {query_word: "What", is_stop_word: true},
+ {query_word: "ABOUT", is_stop_word: true},
+ {query_word: "Grail", is_stop_word: false},
+ ],
+ };
+ current_filter = set_filter([
+ ["stream", streamA_id.toString()],
+ ["search", "What ABOUT Grail"],
+ ]);
+ narrow_banner.show_empty_narrow_message(current_filter);
+ assert.equal(
+ $(".empty_feed_notice_main").html(),
+ empty_narrow_html(
+ "translated: No search results.",
+ undefined,
+ undefined,
+ expected_search_data_capitalization_case,
+ ),
+ );
});
run_test("show_invalid_narrow_message", ({mock_template}) => {