Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
left_sidebar: Hide new topic button on restricted compose permission.
Pratik Chanda34ff1de3384d
diff --git a/web/src/stream_list.ts b/web/src/stream_list.tsindex 3e653cc038b..2356fb794b3 100644--- a/web/src/stream_list.ts+++ b/web/src/stream_list.ts@@ -445,6 +445,7 @@ export function set_in_home_view(stream_id: number, in_home: boolean): void {function build_stream_sidebar_li(sub: StreamSubscription): JQuery {const name = sub.name;const is_muted = stream_data.is_muted(sub.stream_id);+ const can_post_messages = stream_data.can_post_messages_in_stream(sub);const args = {name,id: sub.stream_id,@@ -455,6 +456,7 @@ function build_stream_sidebar_li(sub: StreamSubscription): JQuery {color: sub.color,pin_to_top: sub.pin_to_top,hide_unread_count: settings_data.should_mask_unread_count(is_muted),+ can_post_messages,};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.hbsindex bbbffe8a339..0808881a2ee 100644--- a/web/templates/stream_sidebar_row.hbs+++ b/web/templates/stream_sidebar_row.hbs@@ -11,9 +11,11 @@<a href="{{url}}" title="{{name}}" class="stream-name">{{name}}</a><div class="left-sidebar-controls">+ {{#if can_post_messages}}<div class="channel-new-topic-button tippy-zulip-tooltip hidden-for-spectators" data-tippy-content="{{t 'New topic'}}" data-stream-id="{{id}}"><i class="channel-new-topic-icon zulip-icon zulip-icon-square-plus" aria-hidden="true"></i></div>+ {{/if}}</div><div class="stream-markers-and-unreads">diff --git a/web/tests/stream_list.test.js b/web/tests/stream_list.test.jsindex 0d77fbc0495..5d23a521553 100644--- a/web/tests/stream_list.test.js+++ b/web/tests/stream_list.test.js@@ -7,9 +7,14 @@ const {run_test, noop} = require("./lib/test");const $ = require("./lib/zjquery");const {page_params} = require("./lib/zpage_params");+const people = zrequire("people");+const {set_current_user} = zrequire("state_data");+set_global("document", "document-stub");page_params.realm_users = [];+const current_user = {};+set_current_user(current_user);// We use this with override.let unread_unmuted_count;@@ -39,6 +44,16 @@ const {initialize_user_settings} = zrequire("user_settings");const user_settings = {};initialize_user_settings({user_settings});+const me = {+ email: "[email protected]",+ user_id: 30,+ full_name: "Me Myself",+ date_joined: new Date(),+};++people.add_active_user(me);+people.initialize_current_user(me.user_id);+const devel = {name: "devel",stream_id: 100,@@ -673,6 +688,7 @@ test_ui("rename_stream", ({mock_template, override}) => {color: payload.color,pin_to_top: true,hide_unread_count: true,+ can_post_messages: true,});return {to_$: () => $li_stub};});