mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
compose: Retain compose state across narrows if recipient was edited.
Uptil now, the compose box's state was retained across narrows only if the compose box had any content in it. Else it was reset to match the current narrow. To not lose any changes made to the recipient fields only, the compose box will now retain its state also if the recipient (stream, topic or PMs) has been manually edited. This is achieved by having a variable in `compose_state` track if the recipient fields were changed, and checking it before resetting the compose box on narrowing. This variable is reset when the compose box's context is changed by clicking on a message, or when a message is sent. Fixes: #23064.
This commit is contained in:
@@ -210,6 +210,7 @@ export function send_message_success(local_id, message_id, locally_echoed) {
|
||||
}
|
||||
|
||||
export function send_message(request = create_message_object()) {
|
||||
compose_state.set_recipient_edited_manually(false);
|
||||
if (request.type === "private") {
|
||||
request.to = JSON.stringify(request.to);
|
||||
} else {
|
||||
@@ -424,7 +425,10 @@ export function initialize() {
|
||||
).on("keyup", update_on_recipient_change);
|
||||
$(
|
||||
"#stream_message_recipient_stream,#stream_message_recipient_topic,#private_message_recipient",
|
||||
).on("change", update_on_recipient_change);
|
||||
).on("change", () => {
|
||||
update_on_recipient_change();
|
||||
compose_state.set_recipient_edited_manually(true);
|
||||
});
|
||||
$("#compose-textarea").on("keydown", (event) => {
|
||||
compose_ui.handle_keydown(event, $("#compose-textarea").expectOne());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user