settings: Remove dense_mode setting.

This commit is contained in:
Sahil Batra
2025-03-08 15:45:42 +05:30
committed by Tim Abbott
parent c8b1de6076
commit e2d9d069e0
16 changed files with 66 additions and 188 deletions

View File

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

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 = 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. Bump

View File

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

View File

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

View File

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

View File

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

View File

@@ -42,7 +42,6 @@ export const user_settings_schema = stream_notification_settings_schema
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(),

View File

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

View File

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

View File

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

View File

@@ -82,7 +82,6 @@ class UserBaseSettings(models.Model):
WEB_FONT_SIZE_PX_DEFAULT = 16
WEB_LINE_HEIGHT_PERCENT_COMPACT = 122
WEB_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,

View File

@@ -12243,8 +12243,12 @@ paths:
Note that this endpoint cannot, at present, be used to modify
settings 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 will
be returned in the JSON success response.
@@ -12264,12 +12268,6 @@ paths:
schema:
type: object
properties:
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: true
starred_message_counts:
description: |
Whether clients should display the [number of starred
@@ -12787,8 +12785,6 @@ paths:
type: boolean
example: true
encoding:
dense_mode:
contentType: application/json
starred_message_counts:
contentType: application/json
receives_typing_notifications:
@@ -14436,7 +14432,11 @@ paths:
works, avoids clients needing to worry about large classes of
potentially 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` property
was returned by the response. It was removed because it
had 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 are
available for clients without the `user_settings_object` client
capability for backwards-compatibility.
additionalProperties: false
@@ -15676,11 +15680,6 @@ paths:
type: boolean
description: |
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: integer
description: |
@@ -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_capabilities
emojiset:
deprecated: true
@@ -18393,11 +18373,6 @@ paths:
`realm_default_twenty_four_hour_time` in
the top-level response object (only when `realm` was
present 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: integer
description: |
@@ -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 not
change how request parameters are encoded. However, it did change
@@ -19534,15 +19513,6 @@ paths:
the `PATCH /settings/display` endpoint.
type: boolean
example: 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: true
web_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/json
web_mark_read_on_scroll_policy:
contentType: application/json
web_channel_default_view:

View File

@@ -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.
continue
self.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 configuration
realm_user_default = RealmUserDefault.objects.get(realm=realm)
realm_user_default.dense_mode = True
realm_user_default.web_font_size_px = RealmUserDefault.WEB_FONT_SIZE_PX_COMPACT
realm_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(

View File

@@ -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 = True
hamlet.web_font_size_px = 14
hamlet.web_line_height_percent = 122
hamlet.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):

View File

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

View File

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