user_settings: Add field web_suggest_update_timezone.

This field tracks whether the user should be shown an
alert offering to update their profile time zone to the
time zone of the browser in case they differ.

The field is added to RealmUserDefault and UserProfile
models with a default value of True.

Fixes part of #16957
This commit is contained in:
Kislay Verma
2024-06-14 00:10:05 +05:30
committed by Tim Abbott
parent 143ca5065e
commit 00df8a593d
8 changed files with 77 additions and 1 deletions

View File

@@ -20,6 +20,14 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 10.0
**Feature level 329**
* [`PATCH /realm/user_settings_defaults`](/api/update-realm-user-settings-defaults),
[`POST /register`](/api/register-queue), [`PATCH /settings`](/api/update-settings):
Added new `web_suggest_update_timezone` option to decide whether the user should be
shown an alert offering to update their profile time zone to the time zone of the
browser in case they differ.
**Feature level 328**
* [`GET /messages`](/api/get-messages), [`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 = 328 # Last bumped for removing `user` dictionary from `reactions` object.
API_FEATURE_LEVEL = 329 # Last bumped for adding field web_suggest_update_timezone
# 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

@@ -81,6 +81,7 @@ export const user_settings_schema = stream_notification_settings_schema
web_mark_read_on_scroll_policy: z.number(),
web_navigate_to_sent_message: z.boolean(),
web_stream_unreads_count_display_policy: z.number(),
web_suggest_update_timezone: z.boolean(),
});
export type UserSettings = z.infer<typeof user_settings_schema>;

View File

@@ -0,0 +1,22 @@
# Generated by Django 5.0.6 on 2024-06-13 18:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0640_merge_20241211_1953"),
]
operations = [
migrations.AddField(
model_name="realmuserdefault",
name="web_suggest_update_timezone",
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name="userprofile",
name="web_suggest_update_timezone",
field=models.BooleanField(default=True),
),
]

View File

@@ -68,6 +68,7 @@ class UserBaseSettings(models.Model):
display_emoji_reaction_users = models.BooleanField(default=True)
twenty_four_hour_time = models.BooleanField(default=False)
starred_message_counts = models.BooleanField(default=True)
web_suggest_update_timezone = models.BooleanField(default=True)
COLOR_SCHEME_AUTOMATIC = 1
COLOR_SCHEME_DARK = 2
COLOR_SCHEME_LIGHT = 3
@@ -357,6 +358,7 @@ class UserBaseSettings(models.Model):
web_font_size_px=int,
web_line_height_percent=int,
web_navigate_to_sent_message=bool,
web_suggest_update_timezone=bool,
)
modern_notification_settings: dict[str, Any] = dict(

View File

@@ -11863,6 +11863,14 @@ paths:
only options to disable sending typing notifications.
type: boolean
example: true
web_suggest_update_timezone:
description: |
Whether the user should be shown an alert offering to update their profile time zone
to the time zone of the browser in case they differ.
**Changes**: New in Zulip 10.0 (feature level 329).
type: boolean
example: true
fluid_layout_width:
description: |
Whether to use the [maximum available screen width](/help/enable-full-width-display)
@@ -12353,6 +12361,8 @@ paths:
contentType: application/json
receives_typing_notifications:
contentType: application/json
web_suggest_update_timezone:
contentType: application/json
fluid_layout_width:
contentType: application/json
high_contrast_mode:
@@ -15197,6 +15207,13 @@ paths:
**Changes**: New in Zulip 9.0 (feature level 253). Previously, there were
only options to disable sending typing notifications.
web_suggest_update_timezone:
type: boolean
description: |
Whether the user should be shown an alert offering to update their profile time zone
to the time zone of the browser in case they differ.
**Changes**: New in Zulip 10.0 (feature level 329).
fluid_layout_width:
type: boolean
description: |
@@ -16305,6 +16322,13 @@ paths:
**Changes**: New in Zulip 9.0 (feature level 253). Previously, there were
only options to disable sending typing notifications.
web_suggest_update_timezone:
type: boolean
description: |
Whether the user should be shown an alert offering to update their profile time zone
to the time zone of the browser in case they differ.
**Changes**: New in Zulip 10.0 (feature level 329).
enter_sends:
deprecated: true
type: boolean
@@ -17721,6 +17745,13 @@ paths:
**Changes**: New in Zulip 9.0 (feature level 253). Previously, there were
only options to disable sending typing notifications.
web_suggest_update_timezone:
type: boolean
description: |
Whether the user should be shown an alert offering to update their profile time zone
to the time zone of the browser in case they differ.
**Changes**: New in Zulip 10.0 (feature level 329).
fluid_layout_width:
type: boolean
description: |
@@ -18876,6 +18907,14 @@ paths:
options to disable sending typing notifications.
type: boolean
example: true
web_suggest_update_timezone:
type: boolean
description: |
Whether the user should be shown an alert offering to update their profile time zone
to the time zone of the browser in case they differ.
**Changes**: New in Zulip 10.0 (feature level 329).
example: true
fluid_layout_width:
description: |
Whether to use the [maximum available screen width](/help/enable-full-width-display)
@@ -19467,6 +19506,8 @@ paths:
contentType: application/json
receives_typing_notifications:
contentType: application/json
web_suggest_update_timezone:
contentType: application/json
fluid_layout_width:
contentType: application/json
high_contrast_mode:

View File

@@ -632,6 +632,7 @@ def update_realm_user_settings_defaults(
]
| None = None,
web_navigate_to_sent_message: Json[bool] | None = None,
web_suggest_update_timezone: Json[bool] | None = None,
) -> HttpResponse:
if notification_sound is not None or email_notifications_batching_period_seconds is not None:
check_settings_values(notification_sound, email_notifications_batching_period_seconds)

View File

@@ -328,6 +328,7 @@ def json_change_settings(
]
| None = None,
web_navigate_to_sent_message: Json[bool] | None = None,
web_suggest_update_timezone: Json[bool] | None = None,
) -> HttpResponse:
# UserProfile object is being refetched here to make sure that we
# do not use stale object from cache which can happen when a