Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
reload: Manually save draft and preserve id when triggering reload.
YashRE42be76d7592a60
diff --git a/static/js/compose_actions.js b/static/js/compose_actions.jsindex 3863aa4b0a3..93f7295231d 100644--- a/static/js/compose_actions.js+++ b/static/js/compose_actions.js@@ -276,6 +276,10 @@ export function start(msg_type, opts) {compose_state.message_content(opts.content);}+ if (opts.draft_id) {+ $("#compose-textarea").data("draft-id", opts.draft_id);+ }+compose_state.set_message_type(msg_type);// Show either stream/topic fields or "You and" field.diff --git a/static/js/reload.js b/static/js/reload.jsindex 01d969bfebd..c0a67448350 100644--- a/static/js/reload.js+++ b/static/js/reload.js@@ -6,6 +6,7 @@ import * as compose from "./compose";import * as compose_actions from "./compose_actions";import * as compose_state from "./compose_state";import {csrf_token} from "./csrf";+import * as drafts from "./drafts";import * as hash_util from "./hash_util";import * as hashchange from "./hashchange";import {localstorage} from "./localstorage";@@ -49,6 +50,10 @@ function preserve_state(send_after_reload, save_pointer, save_narrow, save_compoif (msg_type) {url += "+msg=" + encodeURIComponent(compose_state.message_content());+ const draft_id = drafts.update_draft();+ if (draft_id) {+ url += "+draft_id=" + encodeURIComponent(draft_id);+ }}}@@ -147,6 +152,7 @@ export function initialize() {topic: topic || "",private_message_recipient: vars.recipient || "",content: vars.msg || "",+ draft_id: vars.draft_id || "",});if (send_now) {compose.finish();