mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 03:41:58 +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:
@@ -143,12 +143,12 @@ exports.update_messages = function update_messages(events) {
|
||||
var going_forward_change = _.indexOf(['change_later', 'change_all'], event.propagate_mode) >= 0;
|
||||
|
||||
var stream_name = stream_data.get_sub_by_id(event.stream_id).name;
|
||||
var compose_stream_name = compose.stream_name();
|
||||
var compose_stream_name = compose_state.stream_name();
|
||||
|
||||
if (going_forward_change && stream_name && compose_stream_name) {
|
||||
if (stream_name.toLowerCase() === compose_stream_name.toLowerCase()) {
|
||||
if (event.orig_subject === compose.subject()) {
|
||||
compose.subject(event.subject);
|
||||
if (event.orig_subject === compose_state.subject()) {
|
||||
compose_state.subject(event.subject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user