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.
This commit is contained in:
Sahil Batra 2024-02-09 16:49:09 +05:30 committed by Tim Abbott
parent 54bc960898
commit 7da8f9650c
1 changed files with 5 additions and 1 deletions

View File

@ -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 {