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

Fixes #35573.
This commit is contained in:
Lauryn Menard
2025-08-01 13:56:11 +02:00
committed by Tim Abbott
parent 624988d498
commit 7a9b78f1f5
15 changed files with 103 additions and 2 deletions

View File

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

View File

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

View File

@@ -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(),

View File

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

View File

@@ -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",
}),

View File

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

View File

@@ -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(),

View File

@@ -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" }}

View File

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

View File

@@ -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",

View File

@@ -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),
),
]

View File

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

View File

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

View File

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

View File

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