Keep in-progress compose open on narrows.

If the user has text in the compose box, don't close or
change the compose box when they narrow.

(imported from commit f9b400f6bac37cb313f1fd87aadb3ba1d3a035ef)
This commit is contained in:
Steve Howell 2013-10-10 10:43:49 -04:00
parent 8017fc9a15
commit 89cbda5001
2 changed files with 14 additions and 3 deletions

View File

@ -399,6 +399,11 @@ exports.subject = get_or_set('subject');
exports.message_content = get_or_set('new_message_content', true); exports.message_content = get_or_set('new_message_content', true);
exports.recipient = get_or_set('private_message_recipient'); exports.recipient = get_or_set('private_message_recipient');
exports.has_message_content = function () {
return exports.message_content() !== "";
};
// *Synchronously* check if a stream exists. // *Synchronously* check if a stream exists.
exports.check_stream_existence = function (stream_name) { exports.check_stream_existence = function (stream_name) {
var result = "error"; var result = "error";

View File

@ -102,7 +102,11 @@ exports.activate = function (operators, opts) {
} }
var filter = new Filter(operators); var filter = new Filter(operators);
compose.cancel(); var had_message_content = compose.has_message_content();
if (!had_message_content) {
compose.cancel();
}
opts = _.defaults({}, opts, { opts = _.defaults({}, opts, {
then_select_id: home_msg_list.selected_id(), then_select_id: home_msg_list.selected_id(),
@ -243,7 +247,7 @@ exports.activate = function (operators, opts) {
$('#search_query').val(Filter.unparse(operators)); $('#search_query').val(Filter.unparse(operators));
search.update_button_visibility(); search.update_button_visibility();
if (opts.trigger === 'sidebar' && exports.narrowed_by_reply()) { if (!had_message_content && opts.trigger === 'sidebar' && exports.narrowed_by_reply()) {
if (exports.narrowed_to_topic()) { if (exports.narrowed_to_topic()) {
compose.start('stream'); compose.start('stream');
} }
@ -315,7 +319,9 @@ exports.deactivate = function () {
return; return;
} }
compose.cancel(); if (!compose.has_message_content()) {
compose.cancel();
}
current_filter = undefined; current_filter = undefined;