From 83414db72eec885e1fc0324e0427a892327ec92e Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Thu, 4 Jul 2024 15:18:17 +0530 Subject: [PATCH] settings: Add 'web_navigate_to_sent_message' setting. In a2ef1d7e9376de270be7537472f937b335119e53, 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. --- api_docs/changelog.md | 7 ++++ version.py | 2 +- web/src/realm_user_settings_defaults.ts | 1 + web/src/server_events_dispatch.js | 1 + web/src/settings_config.ts | 3 ++ web/src/user_settings.ts | 1 + web/templates/settings/display_settings.hbs | 6 +++ web/tests/dispatch.test.js | 5 +++ web/tests/lib/events.js | 7 ++++ ...t_web_navigate_to_sent_message_and_more.py | 22 +++++++++++ zerver/models/users.py | 5 +++ zerver/openapi/zulip.yaml | 38 +++++++++++++++++++ zerver/views/realm.py | 1 + zerver/views/user_settings.py | 1 + 14 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 zerver/migrations/0547_realmuserdefault_web_navigate_to_sent_message_and_more.py diff --git a/api_docs/changelog.md b/api_docs/changelog.md index a6776042b2..d5cd7fcbf7 100644 --- a/api_docs/changelog.md +++ b/api_docs/changelog.md @@ -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 diff --git a/version.py b/version.py index 76d75e88e4..c6afe0f585 100644 --- a/version.py +++ b/version.py @@ -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 diff --git a/web/src/realm_user_settings_defaults.ts b/web/src/realm_user_settings_defaults.ts index 5dc5996585..166c18192a 100644 --- a/web/src/realm_user_settings_defaults.ts +++ b/web/src/realm_user_settings_defaults.ts @@ -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(), }); diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.js index 868bd7aaf5..2a341c7778 100644 --- a/web/src/server_events_dispatch.js +++ b/web/src/server_events_dispatch.js @@ -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; diff --git a/web/src/settings_config.ts b/web/src/settings_config.ts index 23084dbd88..82400c641e 100644 --- a/web/src/settings_config.ts +++ b/web/src/settings_config.ts @@ -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 = { diff --git a/web/src/user_settings.ts b/web/src/user_settings.ts index e4c3a87106..7158240b58 100644 --- a/web/src/user_settings.ts +++ b/web/src/user_settings.ts @@ -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; diff --git a/web/templates/settings/display_settings.hbs b/web/templates/settings/display_settings.hbs index 0bd9db9456..27b9e07d01 100644 --- a/web/templates/settings/display_settings.hbs +++ b/web/templates/settings/display_settings.hbs @@ -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}} +