Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

drafts: Pass draft_id to compose_actions.start as part of compose_args.

Sahil Singh7ecb63c33278
diff --git a/web/src/compose_actions.js b/web/src/compose_actions.js
index 6b39869bb7a..b0f9c7da241 100644
--- a/web/src/compose_actions.js
+++ b/web/src/compose_actions.js
@@ -253,15 +253,15 @@ 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.
show_compose_box(msg_type, opts);
+ if (opts.draft_id) {
+ $("#compose-textarea").data("draft-id", opts.draft_id);
+ }
+
// Show a warning if topic is resolved
compose_validate.warn_if_topic_resolved(true);
diff --git a/web/src/drafts.js b/web/src/drafts.js
index 07bb5bc54ac..8ad13550613 100644
--- a/web/src/drafts.js
+++ b/web/src/drafts.js
@@ -284,7 +284,7 @@ export function restore_draft(draft_id) {
return;
}
- const compose_args = restore_message(draft);
+ const compose_args = {...restore_message(draft), draft_id};
if (compose_args.type === "stream") {
if (draft.stream_id !== "" && draft.topic !== "") {
@@ -309,7 +309,6 @@ export function restore_draft(draft_id) {
compose.clear_preview_area();
compose_actions.start(compose_args.type, compose_args);
compose_ui.autosize_textarea($("#compose-textarea"));
- $("#compose-textarea").data("draft-id", draft_id);
compose_validate.check_overflow_text();
}