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.

inbox_ui: Make it possible to disable channel folders.

Evy Kassirer7d7d4f58d378
diff --git a/api_docs/changelog.md b/api_docs/changelog.md
index d63e2e5da7e..e3d7f161534 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 12.0
+**Feature level 431**
+
+* [`POST /register`](/api/register-queue), [`PATCH /settings`](/api/update-settings),
+ [`PATCH /realm/user_settings_defaults`](/api/update-realm-user-settings-defaults):
+ Added new `web_inbox_show_channel_folders` display setting,
+ controlling whether any [channel folders](/help/channel-folders)
+ configured by the organization are displayed in the Inbox view.
+
**Feature level 430**
* [`GET /export/realm/consents`](/api/get-realm-export-consents): Added an
diff --git a/version.py b/version.py
index d4feecb4460..24a5c778cc4 100644
--- a/version.py
+++ b/version.py
@@ -35,7 +35,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 = 430
+API_FEATURE_LEVEL = 431
# 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/inbox_ui.ts b/web/src/inbox_ui.ts
index bfeab6ba160..878471bb937 100644
--- a/web/src/inbox_ui.ts
+++ b/web/src/inbox_ui.ts
@@ -568,6 +568,9 @@ function get_channel_folder_id(info: {folder_id: number | null; is_pinned: boole
if (info.folder_id === null) {
return OTHER_CHANNELS_FOLDER_ID;
}
+ if (!user_settings.web_inbox_show_channel_folders) {
+ return OTHER_CHANNELS_FOLDER_ID;
+ }
return info.folder_id;
}
diff --git a/web/src/realm_user_settings_defaults.ts b/web/src/realm_user_settings_defaults.ts
index 24c1231b770..03ebf4fe657 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_inbox_show_channel_folders: z.boolean(),
web_left_sidebar_show_channel_folders: z.boolean(),
web_left_sidebar_unreads_count_summary: z.boolean(),
web_line_height_percent: z.number(),
diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.js
index 2c269cd3096..1cd65eb4b20 100644
--- a/web/src/server_events_dispatch.js
+++ b/web/src/server_events_dispatch.js
@@ -946,6 +946,7 @@ export function dispatch_normal_event(event) {
"web_suggest_update_timezone",
"web_left_sidebar_unreads_count_summary",
"web_left_sidebar_show_channel_folders",
+ "web_inbox_show_channel_folders",
];
const original_home_view = user_settings.web_home_view;
@@ -1036,6 +1037,9 @@ export function dispatch_normal_event(event) {
if (event.property === "web_left_sidebar_show_channel_folders") {
stream_list.build_stream_list(true);
}
+ if (event.property === "web_inbox_show_channel_folders") {
+ inbox_ui.complete_rerender();
+ }
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 0ef5443732e..adf1bc45919 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_inbox_show_channel_folders: $t({
+ defaultMessage: "Group channels by folder in the inbox",
+ }),
web_left_sidebar_show_channel_folders: $t({
defaultMessage: "Group channels by folder in the left sidebar",
}),
diff --git a/web/src/user_settings.ts b/web/src/user_settings.ts
index 9745c12936b..8783495c2c1 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_inbox_show_channel_folders: z.boolean(),
web_left_sidebar_show_channel_folders: z.boolean(),
web_left_sidebar_unreads_count_summary: z.boolean(),
web_line_height_percent: z.number(),
diff --git a/web/templates/settings/preferences_information.hbs b/web/templates/settings/preferences_information.hbs
index a077b09c394..adc10af3aae 100644
--- a/web/templates/settings/preferences_information.hbs
+++ b/web/templates/settings/preferences_information.hbs
@@ -63,6 +63,14 @@
render_only=settings_render_only.receives_typing_notifications
prefix=prefix}}
+ {{> settings_checkbox
+ setting_name="web_inbox_show_channel_folders"
+ is_checked=settings_object.web_inbox_show_channel_folders
+ label=settings_label.web_inbox_show_channel_folders
+ render_only=settings_render_only.web_inbox_show_channel_folders
+ help_link="/help/channel-folders"
+ prefix=prefix}}
+
{{> settings_checkbox
setting_name="hide_ai_features"
is_checked=settings_object.hide_ai_features
diff --git a/web/tests/dispatch.test.cjs b/web/tests/dispatch.test.cjs
index 17b371dc105..d5e78f6f270 100644
--- a/web/tests/dispatch.test.cjs
+++ b/web/tests/dispatch.test.cjs
@@ -31,6 +31,9 @@ const {electron_bridge} = mock_esm("../src/electron_bridge", {
const theme = mock_esm("../src/theme");
const emoji_picker = mock_esm("../src/emoji_picker");
const gear_menu = mock_esm("../src/gear_menu");
+mock_esm("../src/inbox_ui", {
+ complete_rerender: noop,
+});
const information_density = mock_esm("../src/information_density");
const linkifiers = mock_esm("../src/linkifiers");
const compose_recipient = mock_esm("../src/compose_recipient");
@@ -1342,6 +1345,10 @@ run_test("user_settings", ({override}) => {
dispatch(event);
assert_same(user_settings.starred_message_counts, true);
+ event = event_fixtures.user_settings__web_inbox_show_channel_folders;
+ dispatch(event);
+ assert_same(user_settings.web_inbox_show_channel_folders, false);
+
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);
diff --git a/web/tests/lib/events.cjs b/web/tests/lib/events.cjs
index 55e6e206fe0..13bb9dd28a3 100644
--- a/web/tests/lib/events.cjs
+++ b/web/tests/lib/events.cjs
@@ -1250,6 +1250,13 @@ exports.fixtures = {
value: "recent_topics",
},
+ user_settings__web_inbox_show_channel_folders: {
+ type: "user_settings",
+ op: "update",
+ property: "web_inbox_show_channel_folders",
+ value: false,
+ },
+
user_settings__web_left_sidebar_show_channel_folders: {
type: "user_settings",
op: "update",
diff --git a/zerver/migrations/0757_realmuserdefault_web_inbox_show_channel_folders_and_more.py b/zerver/migrations/0757_realmuserdefault_web_inbox_show_channel_folders_and_more.py
new file mode 100644
index 00000000000..8adf37d4bd7
--- /dev/null
+++ b/zerver/migrations/0757_realmuserdefault_web_inbox_show_channel_folders_and_more.py
@@ -0,0 +1,22 @@
+# Generated by Django 5.2.7 on 2025-11-05 18:54
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("zerver", "0756_handle_same_anonymous_group_used_for_multiple_streams"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="realmuserdefault",
+ name="web_inbox_show_channel_folders",
+ field=models.BooleanField(db_default=True, default=True),
+ ),
+ migrations.AddField(
+ model_name="userprofile",
+ name="web_inbox_show_channel_folders",
+ field=models.BooleanField(db_default=True, default=True),
+ ),
+ ]
diff --git a/zerver/models/users.py b/zerver/models/users.py
index 540312217ad..99bbf87d02e 100644
--- a/zerver/models/users.py
+++ b/zerver/models/users.py
@@ -295,6 +295,10 @@ class UserBaseSettings(models.Model):
# Whether the user wants to see typing notifications.
receives_typing_notifications = models.BooleanField(default=True)
+ # UI setting to control showing channel folders in the Inbox view
+ # of the Zulip web app.
+ web_inbox_show_channel_folders = models.BooleanField(default=True, db_default=True)
+
# Who in the organization has access to users' actual email
# addresses. Controls whether the UserProfile.email field is
# the same as UserProfile.delivery_email, or is instead a fake
@@ -370,6 +374,7 @@ class UserBaseSettings(models.Model):
email_address_visibility=int,
web_escape_navigates_to_home_view=bool,
receives_typing_notifications=bool,
+ web_inbox_show_channel_folders=bool,
send_private_typing_notifications=bool,
send_read_receipts=bool,
send_stream_typing_notifications=bool,
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index 7c22776ad11..e098e96534e 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -14200,6 +14200,14 @@ paths:
be hidden in all Zulip clients.
**Changes**: New in Zulip 10.0 (feature level 350).
+ web_inbox_show_channel_folders:
+ type: boolean
+ description: |
+ Determines whether the web/desktop application's Inbox view displays
+ any channel folders configured by the organization.
+
+ **Changes**: New in Zulip 12.0 (feature level 431).
+ example: true
web_left_sidebar_show_channel_folders:
type: boolean
description: |
@@ -14542,6 +14550,8 @@ paths:
contentType: application/json
hide_ai_features:
contentType: application/json
+ web_inbox_show_channel_folders:
+ contentType: application/json
web_left_sidebar_show_channel_folders:
contentType: application/json
web_left_sidebar_unreads_count_summary:
@@ -17869,6 +17879,13 @@ paths:
be hidden in all Zulip clients.
**Changes**: New in Zulip 10.0 (feature level 350).
+ web_inbox_show_channel_folders:
+ type: boolean
+ description: |
+ Determines whether the web/desktop application's Inbox view displays
+ any channel folders configured by the organization.
+
+ **Changes**: New in Zulip 12.0 (feature level 431).
web_left_sidebar_show_channel_folders:
type: boolean
description: |
@@ -20782,6 +20799,13 @@ paths:
be hidden in all Zulip clients.
**Changes**: New in Zulip 10.0 (feature level 350).
+ web_inbox_show_channel_folders:
+ type: boolean
+ description: |
+ Determines whether the web/desktop application's Inbox view displays
+ any channel folders configured by the organization.
+
+ **Changes**: New in Zulip 12.0 (feature level 431).
web_left_sidebar_show_channel_folders:
type: boolean
description: |
@@ -22063,6 +22087,13 @@ paths:
be hidden in all Zulip clients.
**Changes**: New in Zulip 10.0 (feature level 350).
+ web_inbox_show_channel_folders:
+ type: boolean
+ description: |
+ Determines whether the web/desktop application's Inbox view displays
+ any channel folders configured by the organization.
+
+ **Changes**: New in Zulip 12.0 (feature level 431).
web_left_sidebar_show_channel_folders:
type: boolean
description: |
@@ -22492,6 +22523,8 @@ paths:
contentType: application/json
hide_ai_features:
contentType: application/json
+ web_inbox_show_channel_folders:
+ contentType: application/json
web_left_sidebar_show_channel_folders:
contentType: application/json
web_left_sidebar_unreads_count_summary:
diff --git a/zerver/views/realm.py b/zerver/views/realm.py
index 7f88cc79364..0244f20bf95 100644
--- a/zerver/views/realm.py
+++ b/zerver/views/realm.py
@@ -730,6 +730,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_inbox_show_channel_folders: Json[bool] | 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,
diff --git a/zerver/views/user_settings.py b/zerver/views/user_settings.py
index 4b72861d58f..b3611efe820 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_inbox_show_channel_folders: Json[bool] | 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,