Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
settings: Remove dense_mode setting.
Sahil Batrae2d9d069e0f1
diff --git a/api_docs/changelog.md b/api_docs/changelog.mdindex cc5737030d5..51007e01cc6 100644--- a/api_docs/changelog.md+++ b/api_docs/changelog.md@@ -20,6 +20,12 @@ format used by the Zulip server that they are interacting with.## Changes in Zulip 10.0+**Feature level 364**++* [`PATCH /realm/user_settings_defaults`](/api/update-realm-user-settings-defaults),+ [`POST /register`](/api/register-queue), [`PATCH /settings`](/api/update-settings)+ [`GET /events`](/api/get-events): Removed `dense_mode` setting.+**Feature level 363*** `PATCH /realm`, [`GET /events`](/api/get-events),diff --git a/version.py b/version.pyindex ac70adf198f..06fc33dde3f 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 = 363+API_FEATURE_LEVEL = 364# 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. Bumpdiff --git a/web/src/information_density.ts b/web/src/information_density.tsindex e6b6fa372a5..891167b11c4 100644--- a/web/src/information_density.ts+++ b/web/src/information_density.ts@@ -41,14 +41,6 @@ const BODY_FONT_CONTENT_BOX = BODY_FONT_ASCENT + BODY_FONT_DESCENT;// than the line-height.const MAXIMUM_BLOCK_HEIGHT_IN_EMS = BODY_FONT_CONTENT_BOX / BODY_FONT_EM_SIZE;-// Eventually these legacy values and references to them should be removed;-// but in the awkward stage where legacy values are in play for-// certain things (e.g., calculating line-height-based offsets for-// emoji alignment), it's necessary to have access to these values.-export const LEGACY_LINE_HEIGHT_UNITLESS = 1.214;-export const LEGACY_FONT_SIZE_PX = 14;-export const LEGACY_LINE_HEIGHT_PERCENT = 122;-export const NON_COMPACT_MODE_FONT_SIZE_PX = 16;export const NON_COMPACT_MODE_LINE_HEIGHT_PERCENT = 140;@@ -113,9 +105,7 @@ function set_vertical_alignment_values(line_height_unitless: number): void {export function set_base_typography_css_variables(): void {const font_size_px = user_settings.web_font_size_px;const line_height_percent = user_settings.web_line_height_percent;- const line_height_unitless = user_settings.dense_mode- ? LEGACY_LINE_HEIGHT_UNITLESS- : line_height_percent / 100;+ const line_height_unitless = line_height_percent / 100;const line_height_px = line_height_unitless * font_size_px;/* This percentage is a legacy value, rounding up from .294;additional logic might be useful to make this adjustable;@@ -136,9 +126,7 @@ export function set_base_typography_css_variables(): void {}export function calculate_timestamp_widths(): void {- const base_font_size_px = user_settings.dense_mode- ? LEGACY_FONT_SIZE_PX- : user_settings.web_font_size_px;+ const base_font_size_px = user_settings.web_font_size_px;const $temp_time_div = $("<div>");$temp_time_div.attr("id", "calculated-timestamp-widths");// Size the div to the width of the largest timestamp,diff --git a/web/src/realm_user_settings_defaults.ts b/web/src/realm_user_settings_defaults.tsindex 031c3d458c6..3b7dfd04dc2 100644--- a/web/src/realm_user_settings_defaults.ts+++ b/web/src/realm_user_settings_defaults.ts@@ -11,7 +11,6 @@ export const realm_default_settings_schema = z.object({color_scheme: z.number(),default_language: z.string(),demote_inactive_streams: z.number(),- dense_mode: z.boolean(),desktop_icon_count_display: z.number(),display_emoji_reaction_users: z.boolean(),email_address_visibility: z.number(),diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.jsindex c9ea3cc8ff0..6e8be9aecc9 100644--- a/web/src/server_events_dispatch.js+++ b/web/src/server_events_dispatch.js@@ -902,15 +902,15 @@ export function dispatch_normal_event(event) {activity_ui.build_user_sidebar();}if (- event.property === "dense_mode" ||event.property === "web_font_size_px" ||event.property === "web_line_height_percent") {- // We just ignore events for "dense_mode", "web_font_size_px"- // and "web_line_height_percent" settings as we are fine- // with a window not being updated due to changes being done- // from another window and also helps in avoiding weird issues- // on clicking the "+"/"-" buttons multiple times quickly when+ // We just ignore events for web_font_size_px"+ // and "web_line_height_percent" settings as we+ // are fine with a window not being updated due+ // to changes being done from another window and+ // also helps in avoiding weird issues on clicking+ // the "+"/"-" buttons multiple times quickly when// updating these settings.}diff --git a/web/src/ui_init.js b/web/src/ui_init.jsindex 3552f6b4821..2c85e6ddb72 100644--- a/web/src/ui_init.js+++ b/web/src/ui_init.js@@ -302,12 +302,6 @@ export function initialize_kitchen_sink_stuff() {$("body").addClass("high-contrast");}- if (!user_settings.dense_mode) {- $("body").addClass("less-dense-mode");- } else {- $("body").addClass("more-dense-mode");- }-$(window).on("blur", () => {$(document.body).addClass("window_blurred");});diff --git a/web/src/user_settings.ts b/web/src/user_settings.tsindex 419b1b1be33..c2d10cde524 100644--- a/web/src/user_settings.ts+++ b/web/src/user_settings.ts@@ -42,7 +42,6 @@ export const user_settings_schema = stream_notification_settings_schemacolor_scheme: z.number(),default_language: z.string(),demote_inactive_streams: z.number(),- dense_mode: z.boolean(),desktop_icon_count_display: z.number(),display_emoji_reaction_users: z.boolean(),email_address_visibility: z.number(),diff --git a/web/tests/dispatch.test.cjs b/web/tests/dispatch.test.cjsindex bc756e884da..74537589372 100644--- a/web/tests/dispatch.test.cjs+++ b/web/tests/dispatch.test.cjs@@ -1040,14 +1040,6 @@ run_test("user_settings", ({override}) => {dispatch(event);assert_same(user_settings.web_channel_default_view, 1);- event = event_fixtures.user_settings__dense_mode;- override(user_settings, "dense_mode", false);- toggled = [];- assert_same(event.value, true);- dispatch(event);- assert_same(user_settings.dense_mode, false);- assert_same(toggled, []);-event = event_fixtures.user_settings__web_font_size_px;override(user_settings, "web_font_size_px", 14);assert_same(event.value, 16);diff --git a/web/tests/lib/events.cjs b/web/tests/lib/events.cjsindex 9f25c7be280..3e838872382 100644--- a/web/tests/lib/events.cjs+++ b/web/tests/lib/events.cjs@@ -977,13 +977,6 @@ exports.fixtures = {value: 2,},- user_settings__dense_mode: {- type: "user_settings",- op: "update",- property: "dense_mode",- value: true,- },-user_settings__display_emoji_reaction_users: {type: "user_settings",op: "update",diff --git a/zerver/migrations/0685_remove_realmuserdefault_dense_mode_and_more.py b/zerver/migrations/0685_remove_realmuserdefault_dense_mode_and_more.pynew file mode 100644index 00000000000..b80dbfb1ea6--- /dev/null+++ b/zerver/migrations/0685_remove_realmuserdefault_dense_mode_and_more.py@@ -0,0 +1,20 @@+# Generated by Django 5.1.6 on 2025-03-08 09:52++from django.db import migrations+++class Migration(migrations.Migration):+ dependencies = [+ ("zerver", "0684_remove_userprofile_is_billing_admin"),+ ]++ operations = [+ migrations.RemoveField(+ model_name="realmuserdefault",+ name="dense_mode",+ ),+ migrations.RemoveField(+ model_name="userprofile",+ name="dense_mode",+ ),+ ]diff --git a/zerver/models/users.py b/zerver/models/users.pyindex 30f51fb81a6..fa8a48a7c40 100644--- a/zerver/models/users.py+++ b/zerver/models/users.py@@ -82,7 +82,6 @@ class UserBaseSettings(models.Model):WEB_FONT_SIZE_PX_DEFAULT = 16WEB_LINE_HEIGHT_PERCENT_COMPACT = 122WEB_LINE_HEIGHT_PERCENT_DEFAULT = 140- dense_mode = models.BooleanField(default=False)web_font_size_px = models.PositiveSmallIntegerField(default=WEB_FONT_SIZE_PX_DEFAULT)web_line_height_percent = models.PositiveSmallIntegerField(default=WEB_LINE_HEIGHT_PERCENT_DEFAULT@@ -307,7 +306,6 @@ class UserBaseSettings(models.Model):default_language=str,web_home_view=str,demote_inactive_streams=int,- dense_mode=bool,emojiset=str,enable_drafts_synchronization=bool,enter_sends=bool,diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex b3e536ed127..52c1d8ad7cb 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -12243,8 +12243,12 @@ paths:Note that this endpoint cannot, at present, be used to modifysettings for existing users in any way.- **Changes**: New in Zulip 5.0 (feature level 96). If any parameters- sent in the request are not supported by this endpoint, an+ **Changes**: Removed `dense_mode` setting in Zulip 10.0 (feature level 364)+ as we now have `web_font_size_px` and `web_line_height_percent`+ settings for more control.++ New in Zulip 5.0 (feature level 96). If any parameters sent in the+ request are not supported by this endpoint, an[`ignored_parameters_unsupported`][ignored-parameters] array willbe returned in the JSON success response.@@ -12264,12 +12268,6 @@ paths:schema:type: objectproperties:- dense_mode:- description: |- This setting has no effect at present. It is reserved for use in controlling- the default font size in Zulip.- type: boolean- example: truestarred_message_counts:description: |Whether clients should display the [number of starred@@ -12787,8 +12785,6 @@ paths:type: booleanexample: trueencoding:- dense_mode:- contentType: application/jsonstarred_message_counts:contentType: application/jsonreceives_typing_notifications:@@ -14436,7 +14432,11 @@ paths:works, avoids clients needing to worry about large classes ofpotentially messy races, etc.- **Changes**: Before Zulip 7.0 (feature level 183), the+ **Changes**: Removed `dense_mode` setting in Zulip 10.0 (feature level 364)+ as we now have `web_font_size_px` and `web_line_height_percent`+ settings for more control.++ Before Zulip 7.0 (feature level 183), the`realm_community_topic_editing_limit_seconds` propertywas returned by the response. It was removed because ithad not been in use since the realm setting@@ -15666,8 +15666,12 @@ paths:A dictionary containing the user's personal settings.- **Changes**: New in Zulip 5.0 (feature level 89). Previously,- these settings appeared in the top-level object, where they are+ **Changes**: Removed `dense_mode` setting in Zulip 10.0+ (feature level 364) as we now have `web_font_size_px` and+ `web_line_height_percent` settings for more control.++ New in Zulip 5.0 (feature level 89). Previously, these+ settings appeared in the top-level object, where they areavailable for clients without the `user_settings_object` clientcapability for backwards-compatibility.additionalProperties: false@@ -15676,11 +15680,6 @@ paths:type: booleandescription: |Whether time should be [displayed in 24-hour notation](/help/change-the-time-format).- dense_mode:- type: boolean- description: |- This setting has no effect at present. It is reserved for use in controlling- the default font size in Zulip.web_mark_read_on_scroll_policy:type: integerdescription: |@@ -16630,25 +16629,6 @@ paths:connecting to newer servers should declare the `user_settings_object`client capability and access the `user_settings` object instead.- [capabilities]: /api/register-queue#parameter-client_capabilities- dense_mode:- deprecated: true- type: boolean- description: |- Present if `update_display_settings` is present in `fetch_event_types`- and only for clients that did not include `user_settings_object` in- their [`client_capabilities`][capabilities] when registering the event queue.-- Whether the user has switched on dense mode. Dense mode is an experimental- feature that is only available in development environments.-- See [PATCH /settings](/api/update-settings) for details on- the meaning of this setting.-- **Changes**: Deprecated in Zulip 5.0 (feature level 89). Clients- connecting to newer servers should declare the `user_settings_object`- client capability and access the `user_settings` object instead.-[capabilities]: /api/register-queue#parameter-client_capabilitiesemojiset:deprecated: true@@ -18393,11 +18373,6 @@ paths:`realm_default_twenty_four_hour_time` inthe top-level response object (only when `realm` waspresent in `fetch_event_types`).- dense_mode:- type: boolean- description: |- This setting has no effect at present. It is reserved for use in- controlling the default font size in Zulip.web_mark_read_on_scroll_policy:type: integerdescription: |@@ -19455,11 +19430,15 @@ paths:description: |This endpoint is used to edit the current user's settings.- **Changes**: Prior to Zulip 5.0 (feature level 80), this- endpoint only supported the `full_name`, `email`,- `old_password`, and `new_password` parameters. Notification- settings were managed by `PATCH /settings/notifications`, and- all other settings by `PATCH /settings/display`.+ **Changes**: Removed `dense_mode` setting in Zulip 10.0+ (feature level 364) as we now have `web_font_size_px` and+ `web_line_height_percent` settings for more control.++ Prior to Zulip 5.0 (feature level 80), this endpoint only+ supported the `full_name`, `email`, `old_password`, and+ `new_password` parameters. Notification settings were+ managed by `PATCH /settings/notifications`, and all other+ settings by `PATCH /settings/display`.The feature level 80 migration to merge these endpoints did notchange how request parameters are encoded. However, it did change@@ -19534,15 +19513,6 @@ paths:the `PATCH /settings/display` endpoint.type: booleanexample: true- dense_mode:- description: |- This setting has no effect at present. It is reserved for use in controlling- the default font size in Zulip.-- **Changes**: Before Zulip 5.0 (feature level 80), this setting was managed by- the `PATCH /settings/display` endpoint.- type: boolean- example: trueweb_mark_read_on_scroll_policy:description: |Whether or not to mark messages as read when the user scrolls through their@@ -20197,8 +20167,6 @@ paths:encoding:twenty_four_hour_time:contentType: application/json- dense_mode:- contentType: application/jsonweb_mark_read_on_scroll_policy:contentType: application/jsonweb_channel_default_view:diff --git a/zerver/tests/test_realm.py b/zerver/tests/test_realm.pyindex 8aeb4ff9026..4679b2b071f 100644--- a/zerver/tests/test_realm.py+++ b/zerver/tests/test_realm.py@@ -2405,9 +2405,6 @@ class RealmAPITest(ZulipTestCase):"allow_private_data_export",]:continue- if prop in ["dense_mode"]:- # Testing this is complicated, see test_update_default_information_density_settings.- continueself.do_test_realm_default_setting_update_api(prop)def test_update_default_information_density_settings(self) -> None:@@ -2415,7 +2412,6 @@ class RealmAPITest(ZulipTestCase):# Start with the legacy settings configurationrealm_user_default = RealmUserDefault.objects.get(realm=realm)- realm_user_default.dense_mode = Truerealm_user_default.web_font_size_px = RealmUserDefault.WEB_FONT_SIZE_PX_COMPACTrealm_user_default.web_line_height_percent = (RealmUserDefault.WEB_LINE_HEIGHT_PERCENT_COMPACT@@ -2423,63 +2419,31 @@ class RealmAPITest(ZulipTestCase):realm_user_default.save()self.login("iago")- data = {"web_font_size_px": 16, "dense_mode": orjson.dumps(False).decode()}+ data = {"web_font_size_px": 16}result = self.client_patch("/json/realm/user_settings_defaults", data)self.assert_json_success(result)realm_user_default = RealmUserDefault.objects.get(realm=realm)self.assertEqual(realm_user_default.web_font_size_px, 16)- self.assertEqual(realm_user_default.dense_mode, False)data = {"web_font_size_px": 20}result = self.client_patch("/json/realm/user_settings_defaults", data)self.assert_json_success(result)realm_user_default = RealmUserDefault.objects.get(realm=realm)self.assertEqual(realm_user_default.web_font_size_px, 20)- self.assertEqual(realm_user_default.dense_mode, False)-- # Check dense_mode is still false when both the- # settings are set to legacy values.- data = {"web_font_size_px": 14}- result = self.client_patch("/json/realm/user_settings_defaults", data)- self.assert_json_success(result)- realm_user_default = RealmUserDefault.objects.get(realm=realm)- self.assertEqual(realm_user_default.web_font_size_px, 14)- self.assertEqual(realm_user_default.web_line_height_percent, 122)- self.assertEqual(realm_user_default.dense_mode, False)-- data = {"dense_mode": orjson.dumps(True).decode()}- result = self.client_patch("/json/realm/user_settings_defaults", data)- self.assert_json_success(result)- realm_user_default = RealmUserDefault.objects.get(realm=realm)- self.assertEqual(realm_user_default.web_font_size_px, 14)- self.assertEqual(realm_user_default.dense_mode, True)- data = {"web_line_height_percent": 140, "dense_mode": orjson.dumps(False).decode()}+ data = {"web_line_height_percent": 140}result = self.client_patch("/json/realm/user_settings_defaults", data)self.assert_json_success(result)realm_user_default = RealmUserDefault.objects.get(realm=realm)self.assertEqual(realm_user_default.web_line_height_percent, 140)- self.assertEqual(realm_user_default.dense_mode, False)data = {"web_line_height_percent": 130}result = self.client_patch("/json/realm/user_settings_defaults", data)self.assert_json_success(result)realm_user_default = RealmUserDefault.objects.get(realm=realm)self.assertEqual(realm_user_default.web_line_height_percent, 130)- self.assertEqual(realm_user_default.dense_mode, False)-- # Check dense_mode is still false when both the- # settings are set to legacy values.- data = {"web_line_height_percent": 122}- result = self.client_patch("/json/realm/user_settings_defaults", data)- self.assert_json_success(result)- realm_user_default = RealmUserDefault.objects.get(realm=realm)- self.assertEqual(realm_user_default.web_font_size_px, 14)- self.assertEqual(realm_user_default.web_line_height_percent, 122)- self.assertEqual(realm_user_default.dense_mode, False)data = {- "dense_mode": orjson.dumps(True).decode(),"web_font_size_px": 14,"web_line_height_percent": 122,}@@ -2488,7 +2452,6 @@ class RealmAPITest(ZulipTestCase):realm_user_default = RealmUserDefault.objects.get(realm=realm)self.assertEqual(realm_user_default.web_font_size_px, 14)self.assertEqual(realm_user_default.web_line_height_percent, 122)- self.assertEqual(realm_user_default.dense_mode, True)def test_invalid_default_notification_sound_value(self) -> None:result = self.client_patch(diff --git a/zerver/tests/test_settings.py b/zerver/tests/test_settings.pyindex b190c6d32fb..52e39942275 100644--- a/zerver/tests/test_settings.py+++ b/zerver/tests/test_settings.py@@ -225,12 +225,7 @@ class ChangeSettingsTest(ZulipTestCase):def test_toggling_boolean_user_settings(self) -> None:"""Test updating each boolean setting in UserProfile property_types"""boolean_settings = (- s- for s in UserProfile.property_types- if UserProfile.property_types[s] is bool- # Dense mode can't be toggled without changing other settings too.- # This setting is tested in test_changing_information_density_settings.- and s not in ["dense_mode"]+ s for s in UserProfile.property_types if UserProfile.property_types[s] is bool)for user_setting in boolean_settings:self.check_for_toggle_param_patch("/json/settings", user_setting)@@ -574,72 +569,38 @@ class ChangeSettingsTest(ZulipTestCase):def test_changing_information_density_settings(self) -> None:hamlet = self.example_user("hamlet")- hamlet.dense_mode = Truehamlet.web_font_size_px = 14hamlet.web_line_height_percent = 122hamlet.save()self.login("hamlet")- data: dict[str, str | int] = {+ data = {"web_font_size_px": 16,- "dense_mode": orjson.dumps(False).decode(),}result = self.client_patch("/json/settings", data)self.assert_json_success(result)hamlet = self.example_user("hamlet")self.assertEqual(hamlet.web_font_size_px, 16)- self.assertEqual(hamlet.dense_mode, False)data = {"web_font_size_px": 20}result = self.client_patch("/json/settings", data)self.assert_json_success(result)hamlet = self.example_user("hamlet")self.assertEqual(hamlet.web_font_size_px, 20)- self.assertEqual(hamlet.dense_mode, False)-- # Check dense_mode is still false when both the- # settings are set to legacy values.- data = {"web_font_size_px": 14}- result = self.client_patch("/json/settings", data)- self.assert_json_success(result)- hamlet = self.example_user("hamlet")- self.assertEqual(hamlet.web_font_size_px, 14)- self.assertEqual(hamlet.web_line_height_percent, 122)- self.assertEqual(hamlet.dense_mode, False)-- data = {"dense_mode": orjson.dumps(True).decode()}- result = self.client_patch("/json/settings", data)- self.assert_json_success(result)- hamlet = self.example_user("hamlet")- self.assertEqual(hamlet.web_font_size_px, 14)- self.assertEqual(hamlet.dense_mode, True)- data = {"web_line_height_percent": 140, "dense_mode": orjson.dumps(False).decode()}+ data = {"web_line_height_percent": 140}result = self.client_patch("/json/settings", data)self.assert_json_success(result)hamlet = self.example_user("hamlet")self.assertEqual(hamlet.web_line_height_percent, 140)- self.assertEqual(hamlet.dense_mode, False)data = {"web_line_height_percent": 130}result = self.client_patch("/json/settings", data)self.assert_json_success(result)hamlet = self.example_user("hamlet")self.assertEqual(hamlet.web_line_height_percent, 130)- self.assertEqual(hamlet.dense_mode, False)-- # Check dense_mode is still false when both the- # settings are set to legacy values.- data = {"web_line_height_percent": 122}- result = self.client_patch("/json/settings", data)- self.assert_json_success(result)- hamlet = self.example_user("hamlet")- self.assertEqual(hamlet.web_font_size_px, 14)- self.assertEqual(hamlet.web_line_height_percent, 122)- self.assertEqual(hamlet.dense_mode, False)data = {- "dense_mode": orjson.dumps(True).decode(),"web_font_size_px": 14,"web_line_height_percent": 122,}@@ -648,7 +609,6 @@ class ChangeSettingsTest(ZulipTestCase):hamlet = self.example_user("hamlet")self.assertEqual(hamlet.web_font_size_px, 14)self.assertEqual(hamlet.web_line_height_percent, 122)- self.assertEqual(hamlet.dense_mode, True)class UserChangesTest(ZulipTestCase):diff --git a/zerver/views/realm.py b/zerver/views/realm.pyindex c4852e8cb43..44fd6f5cb09 100644--- a/zerver/views/realm.py+++ b/zerver/views/realm.py@@ -586,7 +586,6 @@ def update_realm_user_settings_defaults(request: HttpRequest,user_profile: UserProfile,*,- dense_mode: Json[bool] | None = None,web_mark_read_on_scroll_policy: Json[Annotated[int,diff --git a/zerver/views/user_settings.py b/zerver/views/user_settings.pyindex fb45747a175..039d1866ab8 100644--- a/zerver/views/user_settings.py+++ b/zerver/views/user_settings.py@@ -203,7 +203,6 @@ def json_change_settings(old_password: str | None = None,new_password: str | None = None,twenty_four_hour_time: Json[bool] | None = None,- dense_mode: Json[bool] | None = None,web_mark_read_on_scroll_policy: Annotated[Json[int], check_int_in_validator(UserProfile.WEB_MARK_READ_ON_SCROLL_POLICY_CHOICES)]