Clear compose box immediately after message is sent

(imported from commit 07cf0ca34dea1a64c37261e153730a9564281b3b)
This commit is contained in:
Leo Franchi 2013-12-03 14:59:23 -05:00
parent 9b42cdd826
commit f5af245c09
1 changed files with 17 additions and 7 deletions

View File

@ -449,6 +449,16 @@ function process_send_time(message_id, start_time) {
maybe_report_send_times(message_id);
}
function clear_compose_box() {
$("#new_message_content").val('').focus();
autosize_textarea();
$("#send-status").hide(0);
clear_message_snapshot();
$("#compose-send-button").removeAttr('disabled');
$("#sending-indicator").hide();
ui.resize_bottom_whitespace();
}
function send_message(request) {
if (request === undefined) {
request = create_message_object();
@ -466,14 +476,10 @@ function send_message(request) {
var message_id = data.id;
process_send_time(message_id, start_time);
$("#new_message_content").val('').focus();
autosize_textarea();
$("#send-status").hide(0);
if (! feature_flags.local_echo) {
clear_compose_box();
}
clear_message_snapshot();
$("#compose-send-button").removeAttr('disabled');
$("#sending-indicator").hide();
ui.resize_bottom_whitespace();
setTimeout(function () {
if (exports.send_times_data[message_id].received === undefined) {
blueslip.error("Restarting get_updates due to delayed receipt of sent message " + message_id);
@ -491,6 +497,10 @@ function send_message(request) {
restart_get_updates({dont_block: true});
blueslip.error("Restarting get_updates because it was not running during send");
}
if (feature_flags.local_echo) {
clear_compose_box();
}
}
// This function is for debugging / data collection only. Arguably it