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.

settings: Add user setting to ignore channel folders in left sidebar.

Lauryn Menard7a9b78f1f5ee
diff --git a/api_docs/changelog.md b/api_docs/changelog.md
index c4ba16ec6c2..b5b95fed69b 100644
--- a/api_docs/changelog.md
+++ b/api_docs/changelog.md
@@ -20,6 +20,14 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 11.0
+**Feature level 411**
+
+* [`POST /register`](/api/register-queue), [`PATCH /settings`](/api/update-settings),
+ [`PATCH /realm/user_settings_defaults`](/api/update-realm-user-settings-defaults):
+ Added new `web_left_sidebar_show_channel_folders` display setting,
+ controlling whether any [channel folders](/help/channel-folders)
+ configured by the organization are displayed in the left sidebar.
+
**Feature level 410**
* [`POST /register`](/api/register-queue): Added
diff --git a/version.py b/version.py
index e81e65d1003..c607dbcb37d 100644
--- a/version.py
+++ b/version.py
@@ -34,7 +34,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"
# new level means in api_docs/changelog.md, as well as "**Changes**"
# entries in the endpoint's documentation in `zulip.yaml`.
-API_FEATURE_LEVEL = 410
+API_FEATURE_LEVEL = 411
# Bump the minor PROVISION_VERSION to indicate that folks should provision
# only when going from an old version of the code to a newer version. Bump
diff --git a/web/src/realm_user_settings_defaults.ts b/web/src/realm_user_settings_defaults.ts
index 1d46cdd4805..24c1231b770 100644
--- a/web/src/realm_user_settings_defaults.ts
+++ b/web/src/realm_user_settings_defaults.ts
@@ -59,6 +59,7 @@ export const realm_default_settings_schema = z.object({
web_escape_navigates_to_home_view: z.boolean(),
web_font_size_px: z.number(),
web_home_view: z.string(),
+ web_left_sidebar_show_channel_folders: z.boolean(),
web_left_sidebar_unreads_count_summary: z.boolean(),
web_line_height_percent: z.number(),
web_mark_read_on_scroll_policy: z.number(),
diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.js
index 89bb70abe16..d55ca777339 100644
--- a/web/src/server_events_dispatch.js
+++ b/web/src/server_events_dispatch.js
@@ -905,6 +905,7 @@ export function dispatch_normal_event(event) {
"web_stream_unreads_count_display_policy",
"web_suggest_update_timezone",
"web_left_sidebar_unreads_count_summary",
+ "web_left_sidebar_show_channel_folders",
];
const original_home_view = user_settings.web_home_view;
@@ -992,6 +993,9 @@ export function dispatch_normal_event(event) {
if (event.property === "web_left_sidebar_unreads_count_summary") {
sidebar_ui.update_unread_counts_visibility();
}
+ if (event.property === "web_left_sidebar_show_channel_folders") {
+ stream_list.build_stream_list(true);
+ }
if (
event.property === "receives_typing_notifications" &&
!user_settings.receives_typing_notifications
diff --git a/web/src/settings_config.ts b/web/src/settings_config.ts
index e445a7301f3..9e6ee0904b7 100644
--- a/web/src/settings_config.ts
+++ b/web/src/settings_config.ts
@@ -635,6 +635,9 @@ export const preferences_settings_labels = {
),
receives_typing_notifications: $t({defaultMessage: "Show when other users are typing"}),
starred_message_counts: $t({defaultMessage: "Show counts for starred messages"}),
+ web_left_sidebar_show_channel_folders: $t({
+ defaultMessage: "Group channels by folder in the left sidebar",
+ }),
web_left_sidebar_unreads_count_summary: $t({
defaultMessage: "Show unread count total on home view",
}),
diff --git a/web/src/stream_list_sort.ts b/web/src/stream_list_sort.ts
index 0d88c8739f8..4de0c2a8edd 100644
--- a/web/src/stream_list_sort.ts
+++ b/web/src/stream_list_sort.ts
@@ -154,7 +154,7 @@ export function sort_groups(stream_ids: number[], search_term: string): StreamLi
} else {
pinned_section.streams.push(stream_id);
}
- } else if (sub.folder_id) {
+ } else if (user_settings.web_left_sidebar_show_channel_folders && sub.folder_id) {
const folder = channel_folders.get_channel_folder_by_id(sub.folder_id);
let section = folder_sections.get(sub.folder_id);
if (!section) {
diff --git a/web/src/user_settings.ts b/web/src/user_settings.ts
index 0ac5a27ccf1..9745c12936b 100644
--- a/web/src/user_settings.ts
+++ b/web/src/user_settings.ts
@@ -78,6 +78,7 @@ export const user_settings_schema = z.object({
web_escape_navigates_to_home_view: z.boolean(),
web_font_size_px: z.number(),
web_home_view: z.enum(["inbox", "recent_topics", "all_messages"]),
+ web_left_sidebar_show_channel_folders: z.boolean(),
web_left_sidebar_unreads_count_summary: z.boolean(),
web_line_height_percent: z.number(),
web_mark_read_on_scroll_policy: z.number(),
diff --git a/web/templates/settings/preferences_information.hbs b/web/templates/settings/preferences_information.hbs
index 108a3462d13..0e55556eb0d 100644
--- a/web/templates/settings/preferences_information.hbs
+++ b/web/templates/settings/preferences_information.hbs
@@ -98,6 +98,14 @@
render_only=settings_render_only.fluid_layout_width
prefix=prefix}}
+ {{> settings_checkbox
+ setting_name="web_left_sidebar_show_channel_folders"
+ is_checked=settings_object.web_left_sidebar_show_channel_folders
+ label=settings_label.web_left_sidebar_show_channel_folders
+ render_only=settings_render_only.web_left_sidebar_show_channel_folders
+ help_link="/help/channel-folders"
+ prefix=prefix}}
+
<div class="input-group">
<label for="{{prefix}}demote_inactive_streams" class="settings-field-label">{{t "Hide inactive channels" }}
{{> ../help_link_widget link="/help/manage-inactive-channels" }}
diff --git a/web/tests/dispatch.test.cjs b/web/tests/dispatch.test.cjs
index 04f588a67ee..a7b0584b957 100644
--- a/web/tests/dispatch.test.cjs
+++ b/web/tests/dispatch.test.cjs
@@ -1249,6 +1249,12 @@ run_test("user_settings", ({override}) => {
dispatch(event);
assert_same(user_settings.starred_message_counts, true);
+ event = event_fixtures.user_settings__web_left_sidebar_show_channel_folders;
+ override(stream_list, "build_stream_list", noop);
+ override(user_settings, "web_left_sidebar_show_channel_folders", true);
+ dispatch(event);
+ assert_same(user_settings.web_left_sidebar_show_channel_folders, false);
+
event = event_fixtures.user_settings__web_left_sidebar_unreads_count_summary;
override(sidebar_ui, "update_unread_counts_visibility", noop);
override(user_settings, "web_left_sidebar_unreads_count_summary", true);
diff --git a/web/tests/lib/events.cjs b/web/tests/lib/events.cjs
index 110739744ed..b117fd379ed 100644
--- a/web/tests/lib/events.cjs
+++ b/web/tests/lib/events.cjs
@@ -1217,6 +1217,13 @@ exports.fixtures = {
value: "recent_topics",
},
+ user_settings__web_left_sidebar_show_channel_folders: {
+ type: "user_settings",
+ op: "update",
+ property: "web_left_sidebar_show_channel_folders",
+ value: false,
+ },
+
user_settings__web_left_sidebar_unreads_count_summary: {
type: "user_settings",
op: "update",
diff --git a/zerver/migrations/0745_usersetting_web_left_sidebar_show_channel_folders.py b/zerver/migrations/0745_usersetting_web_left_sidebar_show_channel_folders.py
new file mode 100644
index 00000000000..aa4ad86f79b
--- /dev/null
+++ b/zerver/migrations/0745_usersetting_web_left_sidebar_show_channel_folders.py
@@ -0,0 +1,22 @@
+# Generated by Django 5.2.4 on 2025-08-01 08:39
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("zerver", "0744_alter_channelfolder_name"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="realmuserdefault",
+ name="web_left_sidebar_show_channel_folders",
+ field=models.BooleanField(db_default=True, default=True),
+ ),
+ migrations.AddField(
+ model_name="userprofile",
+ name="web_left_sidebar_show_channel_folders",
+ field=models.BooleanField(db_default=True, default=True),
+ ),
+ ]
diff --git a/zerver/models/users.py b/zerver/models/users.py
index b38da73cb11..afd2ab8d968 100644
--- a/zerver/models/users.py
+++ b/zerver/models/users.py
@@ -112,6 +112,10 @@ class UserBaseSettings(models.Model):
]
demote_inactive_streams = models.PositiveSmallIntegerField(default=DEMOTE_STREAMS_AUTOMATIC)
+ # UI setting to control showing channel folders in the left sidebar
+ # of the Zulip web app.
+ web_left_sidebar_show_channel_folders = models.BooleanField(default=True, db_default=True)
+
# UI setting controlling whether or not the Zulip web app will
# mark messages as read as it scrolls through the feed.
@@ -384,6 +388,7 @@ class UserBaseSettings(models.Model):
hide_ai_features=bool,
resolved_topic_notice_auto_read_policy=ResolvedTopicNoticeAutoReadPolicyEnum,
web_left_sidebar_unreads_count_summary=bool,
+ web_left_sidebar_show_channel_folders=bool,
)
modern_notification_settings = dict(
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index 56da3678912..7dcadaab4c1 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -13879,6 +13879,14 @@ paths:
be hidden in all Zulip clients.
**Changes**: New in Zulip 10.0 (feature level 350).
+ web_left_sidebar_show_channel_folders:
+ type: boolean
+ description: |
+ Determines whether the web/desktop application's left sidebar displays
+ any channel folders configured by the organization.
+
+ **Changes**: New in Zulip 11.0 (feature level 411).
+ example: true
web_left_sidebar_unreads_count_summary:
description: |
Determines whether the web/desktop application's left sidebar displays
@@ -14213,6 +14221,8 @@ paths:
contentType: application/json
hide_ai_features:
contentType: application/json
+ web_left_sidebar_show_channel_folders:
+ contentType: application/json
web_left_sidebar_unreads_count_summary:
contentType: application/json
enable_stream_desktop_notifications:
@@ -17380,6 +17390,13 @@ paths:
be hidden in all Zulip clients.
**Changes**: New in Zulip 10.0 (feature level 350).
+ web_left_sidebar_show_channel_folders:
+ type: boolean
+ description: |
+ Determines whether the web/desktop application's left sidebar displays
+ any channel folders configured by the organization.
+
+ **Changes**: New in Zulip 11.0 (feature level 411).
web_left_sidebar_unreads_count_summary:
type: boolean
description: |
@@ -20274,6 +20291,13 @@ paths:
be hidden in all Zulip clients.
**Changes**: New in Zulip 10.0 (feature level 350).
+ web_left_sidebar_show_channel_folders:
+ type: boolean
+ description: |
+ Determines whether the web/desktop application's left sidebar displays
+ any channel folders configured by the organization.
+
+ **Changes**: New in Zulip 11.0 (feature level 411).
web_left_sidebar_unreads_count_summary:
type: boolean
description: |
@@ -21547,6 +21571,14 @@ paths:
be hidden in all Zulip clients.
**Changes**: New in Zulip 10.0 (feature level 350).
+ web_left_sidebar_show_channel_folders:
+ type: boolean
+ description: |
+ Determines whether the web/desktop application's left sidebar displays
+ any channel folders configured by the organization.
+
+ **Changes**: New in Zulip 11.0 (feature level 411).
+ example: true
web_left_sidebar_unreads_count_summary:
description: |
Determines whether the web/desktop application's left sidebar displays
@@ -21968,6 +22000,8 @@ paths:
contentType: application/json
hide_ai_features:
contentType: application/json
+ web_left_sidebar_show_channel_folders:
+ contentType: application/json
web_left_sidebar_unreads_count_summary:
contentType: application/json
enable_stream_desktop_notifications:
diff --git a/zerver/views/realm.py b/zerver/views/realm.py
index bc6d19ae591..c9b067cabcc 100644
--- a/zerver/views/realm.py
+++ b/zerver/views/realm.py
@@ -724,6 +724,7 @@ def update_realm_user_settings_defaults(
web_escape_navigates_to_home_view: Json[bool] | None = None,
web_font_size_px: Json[int] | None = None,
web_home_view: Literal["recent_topics", "inbox", "all_messages"] | None = None,
+ web_left_sidebar_show_channel_folders: Json[bool] | None = None,
web_left_sidebar_unreads_count_summary: Json[bool] | None = None,
web_line_height_percent: Json[int] | None = None,
web_mark_read_on_scroll_policy: Json[
diff --git a/zerver/views/user_settings.py b/zerver/views/user_settings.py
index 8220814864f..4b72861d58f 100644
--- a/zerver/views/user_settings.py
+++ b/zerver/views/user_settings.py
@@ -332,6 +332,7 @@ def json_change_settings(
web_escape_navigates_to_home_view: Json[bool] | None = None,
web_font_size_px: Json[int] | None = None,
web_home_view: Annotated[str, check_string_in_validator(web_home_view_options)] | None = None,
+ web_left_sidebar_show_channel_folders: Json[bool] | None = None,
web_left_sidebar_unreads_count_summary: Json[bool] | None = None,
web_line_height_percent: Json[int] | None = None,
web_mark_read_on_scroll_policy: Annotated[