settings: Add 'web_navigate_to_sent_message' setting.

In a2ef1d7e93, we made changes so
that when you send a message, your view jumps to the conversation
where you sent it.

For some users it was an improvement, few reported that it
disrupts their workflows.

This prep commit adds a setting which will be used to allow users
to decide whether to automatically go to conversation where they
sent a message.
This commit is contained in:
Prakhar Pratyush 2024-07-04 15:18:17 +05:30 committed by Tim Abbott
parent 8782625f07
commit 83414db72e
14 changed files with 99 additions and 1 deletions

View File

@ -20,6 +20,13 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 9.0
**Feature level 268**
* [`PATCH /realm/user_settings_defaults`](/api/update-realm-user-settings-defaults),
[`POST /register`](/api/register-queue), [`PATCH /settings`](/api/update-settings):
Added a new `web_navigate_to_sent_message` setting to allow users to decide
whether to automatically go to conversation where they sent a message.
**Feature level 267**
* [`GET /invites`](/api/get-invites),[`POST /invites`](/api/send-invites): Added

View File

@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"
# Changes should be accompanied by documentation explaining what the
# new level means in api_docs/changelog.md, as well as "**Changes**"
# entries in the endpoint's documentation in `zulip.yaml`.
API_FEATURE_LEVEL = 267
API_FEATURE_LEVEL = 268
# 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

@ -57,6 +57,7 @@ export const realm_default_settings_schema = z.object({
web_home_view: z.string(),
web_line_height_percent: z.number(),
web_mark_read_on_scroll_policy: z.number(),
web_navigate_to_sent_message: z.boolean(),
web_stream_unreads_count_display_policy: z.number(),
wildcard_mentions_notify: z.boolean(),
});

View File

@ -719,6 +719,7 @@ export function dispatch_normal_event(event) {
"send_stream_typing_notifications",
"send_private_typing_notifications",
"send_read_receipts",
"web_navigate_to_sent_message",
];
const original_home_view = user_settings.web_home_view;

View File

@ -575,6 +575,9 @@ export const preferences_settings_labels = {
web_escape_navigates_to_home_view: $t({defaultMessage: "Escape key navigates to home view"}),
web_font_size_px: $t({defaultMessage: "Message-area font size (px)"}),
web_line_height_percent: $t({defaultMessage: "Message-area line height (%)"}),
web_navigate_to_sent_message: $t({
defaultMessage: "Automatically go to conversation where you sent a message",
}),
};
export const notification_settings_labels = {

View File

@ -76,6 +76,7 @@ export const user_settings_schema = stream_notification_settings_schema
web_home_view: z.enum(["inbox", "recent_topics", "all_messages"]),
web_line_height_percent: z.number(),
web_mark_read_on_scroll_policy: z.number(),
web_navigate_to_sent_message: z.boolean(),
web_stream_unreads_count_display_policy: z.number(),
});
export type UserSettings = z.infer<typeof user_settings_schema>;

View File

@ -139,6 +139,12 @@
label=settings_label.web_escape_navigates_to_home_view
prefix=prefix}}
{{> settings_checkbox
setting_name="web_navigate_to_sent_message"
is_checked=settings_object.web_navigate_to_sent_message
label=settings_label.web_navigate_to_sent_message
prefix=prefix}}
<div class="input-group">
<label for="demote_inactive_streams" class="settings-field-label">{{t "Demote inactive channels" }}
{{> ../help_link_widget link="/help/manage-inactive-channels" }}

View File

@ -1121,6 +1121,11 @@ run_test("user_settings", ({override}) => {
user_settings.email_address_visibility = 3;
dispatch(event);
assert_same(user_settings.email_address_visibility, 5);
event = event_fixtures.user_settings__web_navigate_to_sent_message;
user_settings.web_navigate_to_sent_message = true;
dispatch(event);
assert_same(user_settings.web_navigate_to_sent_message, false);
});
run_test("update_message (read)", ({override}) => {

View File

@ -1071,6 +1071,13 @@ exports.fixtures = {
value: 1,
},
user_settings__web_navigate_to_sent_message: {
type: "user_settings",
op: "update",
property: "web_navigate_to_sent_message",
value: false,
},
user_settings__web_stream_unreads_count_display_policy: {
type: "user_settings",
op: "update",

View File

@ -0,0 +1,22 @@
# Generated by Django 5.0.6 on 2024-07-08 19:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0546_rename_huddle_directmessagegroup_and_more"),
]
operations = [
migrations.AddField(
model_name="realmuserdefault",
name="web_navigate_to_sent_message",
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name="userprofile",
name="web_navigate_to_sent_message",
field=models.BooleanField(default=True),
),
]

View File

@ -153,6 +153,10 @@ class UserBaseSettings(models.Model):
default=WEB_STREAM_UNREADS_COUNT_DISPLAY_POLICY_UNMUTED_STREAMS
)
# Setting to control whether to automatically go to the
# conversation where message was sent.
web_navigate_to_sent_message = models.BooleanField(default=True)
### Notifications settings. ###
email_notifications_batching_period_seconds = models.IntegerField(default=120)
@ -329,6 +333,7 @@ class UserBaseSettings(models.Model):
web_stream_unreads_count_display_policy=int,
web_font_size_px=int,
web_line_height_percent=int,
web_navigate_to_sent_message=bool,
)
modern_notification_settings: Dict[str, Any] = dict(

View File

@ -11552,6 +11552,15 @@ paths:
- 4
- 5
example: 1
web_navigate_to_sent_message:
description: |
Web/desktop app setting for whether the user's view should
automatically go to the conversation where they sent a message.
**Changes**: New in Zulip 9.0 (feature level 268). Previously,
this behavior was not configurable.
type: boolean
example: true
encoding:
dense_mode:
contentType: application/json
@ -11649,6 +11658,8 @@ paths:
contentType: application/json
email_address_visibility:
contentType: application/json
web_navigate_to_sent_message:
contentType: application/json
responses:
"200":
$ref: "#/components/responses/SuccessIgnoredParameters"
@ -14473,6 +14484,14 @@ paths:
**Changes**: New in Zulip 5.0 (feature level 105).
email_address_visibility:
$ref: "#/components/schemas/EmailAddressVisibility"
web_navigate_to_sent_message:
type: boolean
description: |
Web/desktop app setting for whether the user's view should
automatically go to the conversation where they sent a message.
**Changes**: New in Zulip 9.0 (feature level 268). Previously,
this behavior was not configurable.
user_topics:
type: array
description: |
@ -16853,6 +16872,14 @@ paths:
**Changes**: New in Zulip 5.0 (feature level 105).
email_address_visibility:
$ref: "#/components/schemas/EmailAddressVisibility"
web_navigate_to_sent_message:
type: boolean
description: |
Web/desktop app setting for whether the user's view should
automatically go to the conversation where they sent a message.
**Changes**: New in Zulip 9.0 (feature level 268). Previously,
this behavior was not configurable.
realm_users:
type: array
description: |
@ -18140,6 +18167,15 @@ paths:
- 4
- 5
example: 1
web_navigate_to_sent_message:
description: |
Web/desktop app setting for whether the user's view should
automatically go to the conversation where they sent a message.
**Changes**: New in Zulip 9.0 (feature level 268). Previously,
this behavior was not configurable.
type: boolean
example: true
encoding:
twenty_four_hour_time:
contentType: application/json
@ -18241,6 +18277,8 @@ paths:
contentType: application/json
email_address_visibility:
contentType: application/json
web_navigate_to_sent_message:
contentType: application/json
responses:
"200":
$ref: "#/components/responses/SuccessIgnoredParameters"

View File

@ -653,6 +653,7 @@ def update_realm_user_settings_defaults(
email_address_visibility: Optional[int] = REQ(
json_validator=check_int_in(UserProfile.EMAIL_ADDRESS_VISIBILITY_TYPES), default=None
),
web_navigate_to_sent_message: Optional[bool] = REQ(json_validator=check_bool, default=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

@ -315,6 +315,7 @@ def json_change_settings(
email_address_visibility: Optional[int] = REQ(
json_validator=check_int_in(UserProfile.EMAIL_ADDRESS_VISIBILITY_TYPES), default=None
),
web_navigate_to_sent_message: Optional[bool] = REQ(json_validator=check_bool, default=None),
) -> HttpResponse:
if (
default_language is not None