Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
compose: Simplify drafts interface for message content.
Tim Abbotte87b9955c9d8
diff --git a/web/src/compose_actions.js b/web/src/compose_actions.jsindex b0f9c7da241..a4abc164954 100644--- a/web/src/compose_actions.js+++ b/web/src/compose_actions.js@@ -222,8 +222,9 @@ export function start(msg_type, opts) {opts.stream_id = subbed_streams[0].stream_id;}- if (compose_state.composing() && !same_recipient_as_before(msg_type, opts)) {- // Clear the compose box if the existing message is to a different recipient+ if (compose_state.composing() && !same_recipient_as_before(msg_type, opts) && !opts.draft_id) {+ // Clear the compose box if the existing message is to a different recipient or the new+ // content is a draft.clear_box();}@@ -262,6 +263,13 @@ export function start(msg_type, opts) {$("#compose-textarea").data("draft-id", opts.draft_id);}+ if (opts.content !== undefined) {+ // If we were provided with message content, we might need to+ // resize the compose box, or display that it's too long.+ compose_ui.autosize_textarea($("#compose-textarea"));+ compose_validate.check_overflow_text();+ }+// Show a warning if topic is resolvedcompose_validate.warn_if_topic_resolved(true);diff --git a/web/src/drafts.js b/web/src/drafts.jsindex 8ad13550613..50fd7145420 100644--- a/web/src/drafts.js+++ b/web/src/drafts.js@@ -11,10 +11,7 @@ import * as blueslip from "./blueslip";import * as browser_history from "./browser_history";import * as compose from "./compose";import * as compose_actions from "./compose_actions";-import * as compose_fade from "./compose_fade";import * as compose_state from "./compose_state";-import * as compose_ui from "./compose_ui";-import * as compose_validate from "./compose_validate";import * as confirm_dialog from "./confirm_dialog";import {$t, $t_html} from "./i18n";import {localstorage} from "./localstorage";@@ -305,11 +302,7 @@ export function restore_draft(draft_id) {}overlays.close_overlay("drafts");- compose_fade.clear_compose();- compose.clear_preview_area();compose_actions.start(compose_args.type, compose_args);- compose_ui.autosize_textarea($("#compose-textarea"));- compose_validate.check_overflow_text();}const DRAFT_LIFETIME = 30;