Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

channel_settings: Hide channel folder setting for normal user.

Pratik Chanda9d773fe11575
diff --git a/web/src/stream_edit.ts b/web/src/stream_edit.ts
index d3315967f95..0abfc1d2a21 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 8e4948583fa..4bf33935552 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)}}
<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>