mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
Extract compose_state.js.
This is mostly just moving methods out of compose.js. The variable `is_composing_message`, which isn't a boolean, has been renamed to `message_type`, and there are new functions set_message_type() and get_message_type() that wrap it. This commit removes some shims related to the global variable `compose_state`; now, `compose_state` is a typical global variable with a 1:1 relationship with the module by the same name. The new module has 100% line coverage, most of it coming via the tests on compose_actions.js. (The methods here are super simple, so it's a good thing that the tests are somewhat integrated with a higher layer.)
This commit is contained in:
@@ -24,15 +24,15 @@ function preserve_state(send_after_reload, save_pointer, save_narrow, save_compo
|
||||
if (save_compose) {
|
||||
if (compose_state.composing() === 'stream') {
|
||||
url += "+msg_type=stream";
|
||||
url += "+stream=" + encodeURIComponent(compose.stream_name());
|
||||
url += "+subject=" + encodeURIComponent(compose.subject());
|
||||
url += "+stream=" + encodeURIComponent(compose_state.stream_name());
|
||||
url += "+subject=" + encodeURIComponent(compose_state.subject());
|
||||
} else if (compose_state.composing() === 'private') {
|
||||
url += "+msg_type=private";
|
||||
url += "+recipient=" + encodeURIComponent(compose_state.recipient());
|
||||
}
|
||||
|
||||
if (compose_state.composing()) {
|
||||
url += "+msg=" + encodeURIComponent(compose.message_content());
|
||||
url += "+msg=" + encodeURIComponent(compose_state.message_content());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user