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

Show "New message" tooltip for empty topic only channel instead
of "New topic" in left channel sidebar row.
This commit is contained in:
Vector73
2025-07-11 07:20:03 +00:00
committed by Tim Abbott
parent e6845a9b9a
commit 741b38ecfa
3 changed files with 9 additions and 2 deletions

View File

@@ -478,6 +478,7 @@ function build_stream_sidebar_li(sub: StreamSubscription): JQuery {
pin_to_top: sub.pin_to_top, pin_to_top: sub.pin_to_top,
hide_unread_count: settings_data.should_mask_unread_count(is_muted), hide_unread_count: settings_data.should_mask_unread_count(is_muted),
can_post_messages, 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)); const $list_item = $(render_stream_sidebar_row(args));
return $list_item; return $list_item;

View File

@@ -12,7 +12,7 @@
<div class="left-sidebar-controls"> <div class="left-sidebar-controls">
{{#if can_post_messages}} {{#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> <i class="channel-new-topic-icon zulip-icon zulip-icon-square-plus" aria-hidden="true"></i>
</div> </div>
{{/if}} {{/if}}

View File

@@ -8,7 +8,7 @@ const $ = require("./lib/zjquery.cjs");
const {page_params} = require("./lib/zpage_params.cjs"); const {page_params} = require("./lib/zpage_params.cjs");
const people = zrequire("people"); 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"); set_global("document", "document-stub");
@@ -57,6 +57,11 @@ const user_settings = {
initialize_user_settings({user_settings}); initialize_user_settings({user_settings});
stream_list_sort.set_filter_out_inactives(); stream_list_sort.set_filter_out_inactives();
const realm = {
realm_topics_policy: "allow_empty_topic",
};
set_realm(realm);
const me = { const me = {
email: "me@example.com", email: "me@example.com",
user_id: 30, user_id: 30,
@@ -730,6 +735,7 @@ test_ui("rename_stream", ({mock_template, override}) => {
pin_to_top: true, pin_to_top: true,
hide_unread_count: true, hide_unread_count: true,
can_post_messages: true, can_post_messages: true,
is_empty_topic_only_channel: false,
}); });
return {to_$: () => $li_stub}; return {to_$: () => $li_stub};
}); });