mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
compose: Simplify drafts interface for message content.
Previously, we had logic to update the compose box state living in the drafts module, for no particularly good reason.
This commit is contained in:
@@ -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 resolved
|
||||
compose_validate.warn_if_topic_resolved(true);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user