From 7da8f9650c2678139fea5e247937fdfa1da26a16 Mon Sep 17 00:00:00 2001 From: Sahil Batra Date: Fri, 9 Feb 2024 16:49:09 +0530 Subject: [PATCH] streams: Handle "#streams/new" url for users who cannot create streams. We already do not show the buttons for opening the stream creation form if user is not allowed to create streams at all, but the user can still open the form by going on "#streams/new" url. This commit fixes this by redirecting such users to "#streams/subscribed" like we do for guests. --- web/src/stream_settings_ui.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/stream_settings_ui.js b/web/src/stream_settings_ui.js index 52a70600f8..990daf264b 100644 --- a/web/src/stream_settings_ui.js +++ b/web/src/stream_settings_ui.js @@ -702,7 +702,11 @@ function show_right_section() { export function change_state(section, right_side_tab) { // if in #streams/new form. if (section === "new") { - if (!current_user.is_guest) { + 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(); + if (can_create_streams) { do_open_create_stream(); show_right_section(); } else {