From 9d773fe11575facbbdb93d2faeac7149fab85f0a Mon Sep 17 00:00:00 2001 From: Pratik Chanda Date: Wed, 6 Aug 2025 22:28:49 +0530 Subject: [PATCH] channel_settings: Hide channel folder setting for normal user. Earlier, channel folder setting dropdown was showed even when there were no channel folders created yet. This would end up showing an empty list in dropdown. This commit hides the setting for normal users if there are no channel folders available in the org. It is replaced by a string section. Fixes: zulip#35596. --- web/src/stream_edit.ts | 3 +++ web/templates/stream_settings/stream_permissions.hbs | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/web/src/stream_edit.ts b/web/src/stream_edit.ts index d3315967f9..0abfc1d2a2 100644 --- a/web/src/stream_edit.ts +++ b/web/src/stream_edit.ts @@ -17,6 +17,7 @@ import * as blueslip from "./blueslip.ts"; import type {Bot} from "./bot_data.ts"; import * as browser_history from "./browser_history.ts"; import * as channel from "./channel.ts"; +import * as channel_folders from "./channel_folders.ts"; import * as channel_folders_ui from "./channel_folders_ui.ts"; import * as confirm_dialog from "./confirm_dialog.ts"; import {show_copied_confirmation} from "./copied_tooltip.ts"; @@ -256,6 +257,7 @@ export function show_settings_for(node: HTMLElement): void { other_settings.push(setting); return false; }); + const realm_has_channel_folders = channel_folders.get_active_folder_ids().size > 0; const html = render_stream_settings({ sub, @@ -275,6 +277,7 @@ export function show_settings_for(node: HTMLElement): void { group_setting_labels: settings_config.all_group_setting_labels.stream, has_billing_access: settings_data.user_has_billing_access(), empty_string_topic_display_name: util.get_final_topic_display_name(""), + realm_has_channel_folders, }); scroll_util.get_content_element($("#stream_settings")).html(html); diff --git a/web/templates/stream_settings/stream_permissions.hbs b/web/templates/stream_settings/stream_permissions.hbs index 8e4948583f..4bf3393555 100644 --- a/web/templates/stream_settings/stream_permissions.hbs +++ b/web/templates/stream_settings/stream_permissions.hbs @@ -56,6 +56,7 @@ component so that we can show dropdown button and button to create a new folder on same line without having to add much CSS with hardcoded margin and padding values. --}} + {{#if (or is_admin realm_has_channel_folders)}}