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.

stream view: Show "start a conversation" for a topic with no messages.

evykassirer30c6b26f3b7f
diff --git a/web/src/narrow_banner.js b/web/src/narrow_banner.js
index bba027bf48c..05104a9f350 100644
--- a/web/src/narrow_banner.js
+++ b/web/src/narrow_banner.js
@@ -100,6 +100,7 @@ function pick_empty_narrow_banner() {
if (num_operators !== 1) {
// For invalid-multi-operator narrows, we display an invalid narrow message
const streams = current_filter.operands("stream");
+ const topics = current_filter.operands("topic");
// No message can have multiple streams
if (streams.length > 1) {
@@ -112,7 +113,7 @@ function pick_empty_narrow_banner() {
};
}
// No message can have multiple topics
- if (current_filter.operands("topic").length > 1) {
+ if (topics.length > 1) {
return {
title: default_banner_for_multiple_filters,
html: $t_html({
@@ -150,6 +151,11 @@ function pick_empty_narrow_banner() {
return SPECTATOR_STREAM_NARROW_BANNER;
}
+ // A stream > topic that doesn't exist yet.
+ if (num_operators === 2 && streams.length === 1 && topics.length === 1) {
+ return default_banner;
+ }
+
// For other multi-operator narrows, we just use the default banner
return {
title: default_banner_for_multiple_filters,
diff --git a/web/tests/narrow.test.js b/web/tests/narrow.test.js
index fb232797e78..e13a2684fd9 100644
--- a/web/tests/narrow.test.js
+++ b/web/tests/narrow.test.js
@@ -263,7 +263,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: No search results.", ""),
+ empty_narrow_html("translated: There are no messages here."),
);
page_params.is_spectator = false;