Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
left sidebar: Redirect users with no stream create permissions.
Mr.mad22bfa563010a
diff --git a/static/js/popover_menus.js b/static/js/popover_menus.jsindex ae6b5e7b6bf..77713b68783 100644--- a/static/js/popover_menus.js+++ b/static/js/popover_menus.js@@ -61,16 +61,23 @@ export function initialize() {...default_popover_props,target: "#streams_inline_icon",onShow(instance) {+ const can_create_streams =+ settings_data.user_can_create_private_streams() ||+ settings_data.user_can_create_public_streams() ||+ settings_data.user_can_create_web_public_streams();on_show_prep(instance);- instance.setContent(- render_left_sidebar_stream_setting_popover({- can_create_streams:- settings_data.user_can_create_private_streams() ||- settings_data.user_can_create_public_streams() ||- settings_data.user_can_create_web_public_streams(),- }),- );++ if (!can_create_streams) {+ // If the user can't create streams, we directly+ // navigate them to the Manage streams subscribe UI.+ window.location.assign("#streams/all");+ // Returning false from an onShow handler cancels the show.+ return false;+ }++ instance.setContent(render_left_sidebar_stream_setting_popover());left_sidebar_stream_setting_popover_displayed = true;+ return true;},onHidden() {left_sidebar_stream_setting_popover_displayed = false;diff --git a/static/templates/left_sidebar_stream_setting_popover.hbs b/static/templates/left_sidebar_stream_setting_popover.hbsindex 7b0c6c65cb1..04da77661eb 100644--- a/static/templates/left_sidebar_stream_setting_popover.hbs+++ b/static/templates/left_sidebar_stream_setting_popover.hbs@@ -4,11 +4,9 @@{{t "Browse streams" }}</a></li>- {{#if can_create_streams }}<li><a href="#streams/new">{{t "Create a stream" }}</a></li>- {{/if}}</ul>