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.
This commit is contained in:
Pratik Chanda 2025-08-06 22:28:49 +05:30 committed by Tim Abbott
parent eda4a14393
commit 9d773fe115
2 changed files with 10 additions and 0 deletions

View File

@ -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);

View File

@ -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)}}
<label class="settings-field-label" for="{{channel_folder_widget_name}}_widget">
{{t "Channel folder"}}
{{> ../help_link_widget link="/help/channel-folders" }}
@ -74,6 +75,12 @@
}}
{{/if}}
</div>
{{else}}
<span class="settings-field-label">
{{t "There are no channel folders configured in this organization."}}
{{> ../help_link_widget link="/help/channel-folders" }}
</span>
{{/if}}
</div>
</div>