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: Display title only for empty search with multiple filters.

palashb01ce1165720415
diff --git a/web/src/narrow_banner.js b/web/src/narrow_banner.js
index d0615630c94..e2a197e51b1 100644
--- a/web/src/narrow_banner.js
+++ b/web/src/narrow_banner.js
@@ -82,7 +82,7 @@ function pick_empty_narrow_banner() {
},
),
};
- const empty_search_narrow_title = $t({defaultMessage: "No search results"});
+ const default_banner_for_multiple_filters = $t({defaultMessage: "No search results"});
const current_filter = narrow_state.filter();
@@ -102,7 +102,7 @@ function pick_empty_narrow_banner() {
// No message can have multiple streams
if (streams.length > 1) {
return {
- title: empty_search_narrow_title,
+ title: default_banner_for_multiple_filters,
html: $t_html({
defaultMessage:
"<p>You are searching for messages that belong to more than one stream, which is not possible.</p>",
@@ -112,7 +112,7 @@ function pick_empty_narrow_banner() {
// No message can have multiple topics
if (current_filter.operands("topic").length > 1) {
return {
- title: empty_search_narrow_title,
+ title: default_banner_for_multiple_filters,
html: $t_html({
defaultMessage:
"<p>You are searching for messages that belong to more than one topic, which is not possible.</p>",
@@ -122,7 +122,7 @@ function pick_empty_narrow_banner() {
// No message can have multiple senders
if (current_filter.operands("sender").length > 1) {
return {
- title: empty_search_narrow_title,
+ title: default_banner_for_multiple_filters,
html: $t_html({
defaultMessage:
"<p>You are searching for messages that are sent by more than one person, which is not possible.</p>",
@@ -133,7 +133,7 @@ function pick_empty_narrow_banner() {
// For empty stream searches within other narrows, we display the stop words
if (current_filter.operands("search").length > 0) {
return {
- title: empty_search_narrow_title,
+ title: default_banner_for_multiple_filters,
search_data: retrieve_search_query_data(),
};
}
@@ -149,7 +149,9 @@ function pick_empty_narrow_banner() {
}
// For other multi-operator narrows, we just use the default banner
- return default_banner;
+ return {
+ title: default_banner_for_multiple_filters,
+ };
}
switch (first_operator) {
@@ -277,7 +279,7 @@ function pick_empty_narrow_banner() {
case "search": {
// You are narrowed to empty search results.
return {
- title: empty_search_narrow_title,
+ title: $t({defaultMessage: "No search results"}),
search_data: retrieve_search_query_data(),
};
}
diff --git a/web/tests/narrow.test.js b/web/tests/narrow.test.js
index 36052e650f5..623c0473199 100644
--- a/web/tests/narrow.test.js
+++ b/web/tests/narrow.test.js
@@ -282,7 +282,7 @@ run_test("show_empty_narrow_message", ({mock_template}) => {
narrow_banner.show_empty_narrow_message();
assert.equal(
$(".empty_feed_notice_main").html(),
- empty_narrow_html("translated: There are no messages here.", ""),
+ empty_narrow_html("translated: No search results", ""),
);
page_params.is_spectator = false;
@@ -520,10 +520,7 @@ run_test("show_empty_narrow_message", ({mock_template}) => {
narrow_banner.show_empty_narrow_message();
assert.equal(
$(".empty_feed_notice_main").html(),
- empty_narrow_html(
- "translated: There are no messages here.",
- 'translated HTML: Why not <a href="#" class="empty_feed_compose_stream">start the conversation</a>?',
- ),
+ empty_narrow_html("translated: No search results"),
);
set_filter([["is", "invalid"]]);