mirror of https://github.com/zulip/zulip.git
Remove compose.set_mode in favor of compose.start
From Trac ticket #1503: All of the calls to compose.set_mode() should be calling compose.start() instead. Nearly all are impossible to trigger while already composing, and by calling compose.set_mode() they just do the stuff in set_mode() twice. The only case where this would change behavior, that I can see, is if you press C, Shift-Tab to unfocus the compose box without dismissing it and then press c (or vice versa). I think it's okay if we clear the input fields in that unlikely case. (imported from commit ba7f181ec9d1df90a443b0a754462a3a201dcabb)
This commit is contained in:
parent
017bd6b8b1
commit
a7963a24f8
|
@ -422,22 +422,6 @@ exports.clear = function () {
|
|||
$("#send-status").hide(0);
|
||||
};
|
||||
|
||||
// Set the mode of a compose already in progress.
|
||||
// Does not clear the input fields.
|
||||
exports.set_mode = function (mode) {
|
||||
ui.change_tab_to('#home');
|
||||
if (!is_composing_message) {
|
||||
exports.start(mode);
|
||||
}
|
||||
if (mode === 'private') {
|
||||
show('private');
|
||||
is_composing_message = "private";
|
||||
} else {
|
||||
show('stream');
|
||||
is_composing_message = "stream";
|
||||
}
|
||||
};
|
||||
|
||||
exports.composing = function () {
|
||||
return is_composing_message;
|
||||
};
|
||||
|
@ -638,7 +622,7 @@ $(function () {
|
|||
// when text gets added into the composebox.
|
||||
if (!compose.composing()) {
|
||||
respond_to_sent_message = true;
|
||||
compose.set_mode('stream');
|
||||
compose.start('stream');
|
||||
}
|
||||
if (i === -1) {
|
||||
// This is a paste, so there's no filename. Show the image directly
|
||||
|
@ -662,7 +646,7 @@ $(function () {
|
|||
var textbox = $("#new_message_content");
|
||||
if (!compose.composing()) {
|
||||
respond_to_sent_message = true;
|
||||
compose.set_mode('stream');
|
||||
compose.start('stream');
|
||||
}
|
||||
textbox.val(textbox.val() + contents);
|
||||
}
|
||||
|
|
|
@ -246,11 +246,11 @@ function process_hotkey(e) {
|
|||
}
|
||||
return true;
|
||||
case 'compose': // 'c': compose
|
||||
compose.set_mode('stream');
|
||||
compose.start('stream');
|
||||
respond_to_sent_message = true;
|
||||
return true;
|
||||
case 'compose_private_message':
|
||||
compose.set_mode('private');
|
||||
compose.start('private');
|
||||
respond_to_sent_message = true;
|
||||
return true;
|
||||
case 'enter': // Enter: respond to message (unless we need to do something else)
|
||||
|
|
|
@ -1205,11 +1205,11 @@ $(function () {
|
|||
});
|
||||
|
||||
$('.compose_stream_button').click(function (e) {
|
||||
compose.set_mode('stream');
|
||||
compose.start('stream');
|
||||
return false;
|
||||
});
|
||||
$('.compose_private_button').click(function (e) {
|
||||
compose.set_mode('private');
|
||||
compose.start('private');
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue