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.

sidebar: Show "New message" tooltip for empty topic only channel.

Vector73741b38ecfa82
diff --git a/web/src/stream_list.ts b/web/src/stream_list.ts
index ba33d6bd7ef..ceccfe1dda9 100644
--- a/web/src/stream_list.ts
+++ b/web/src/stream_list.ts
@@ -478,6 +478,7 @@ function build_stream_sidebar_li(sub: StreamSubscription): JQuery {
pin_to_top: sub.pin_to_top,
hide_unread_count: settings_data.should_mask_unread_count(is_muted),
can_post_messages,
+ is_empty_topic_only_channel: stream_data.is_empty_topic_only_channel(sub.stream_id),
};
const $list_item = $(render_stream_sidebar_row(args));
return $list_item;
diff --git a/web/templates/stream_sidebar_row.hbs b/web/templates/stream_sidebar_row.hbs
index 2809acf9d8a..9c9187edf7a 100644
--- a/web/templates/stream_sidebar_row.hbs
+++ b/web/templates/stream_sidebar_row.hbs
@@ -12,7 +12,7 @@
<div class="left-sidebar-controls">
{{#if can_post_messages}}
- <div class="channel-new-topic-button tippy-zulip-tooltip hidden-for-spectators auto-hide-left-sidebar-overlay" data-tippy-content="{{t 'New topic'}}" data-stream-id="{{id}}">
+ <div class="channel-new-topic-button tippy-zulip-tooltip hidden-for-spectators auto-hide-left-sidebar-overlay" data-tippy-content="{{#unless is_empty_topic_only_channel}}{{t 'New topic'}}{{else}}{{t 'New message'}}{{/unless}}" data-stream-id="{{id}}">
<i class="channel-new-topic-icon zulip-icon zulip-icon-square-plus" aria-hidden="true"></i>
</div>
{{/if}}
diff --git a/web/tests/stream_list.test.cjs b/web/tests/stream_list.test.cjs
index caf4fb2de47..40134b5c81a 100644
--- a/web/tests/stream_list.test.cjs
+++ b/web/tests/stream_list.test.cjs
@@ -8,7 +8,7 @@ const $ = require("./lib/zjquery.cjs");
const {page_params} = require("./lib/zpage_params.cjs");
const people = zrequire("people");
-const {set_current_user} = zrequire("state_data");
+const {set_current_user, set_realm} = zrequire("state_data");
set_global("document", "document-stub");
@@ -57,6 +57,11 @@ const user_settings = {
initialize_user_settings({user_settings});
stream_list_sort.set_filter_out_inactives();
+const realm = {
+ realm_topics_policy: "allow_empty_topic",
+};
+set_realm(realm);
+
const me = {
user_id: 30,
@@ -730,6 +735,7 @@ test_ui("rename_stream", ({mock_template, override}) => {
pin_to_top: true,
hide_unread_count: true,
can_post_messages: true,
+ is_empty_topic_only_channel: false,
});
return {to_$: () => $li_stub};
});