Move initial call to get_events to server_events.home_view_loaded.

Note that this makes the event fire after the home view has messages
loaded all the way to current; previously it only waited for the first
batch of messages to load.

(imported from commit a5c408ea0136c761f4cc77e8be4977b13acc6d77)
This commit is contained in:
Tim Abbott 2014-01-30 14:32:13 -05:00
parent 1eb294ed11
commit f27edcd50a
2 changed files with 3 additions and 11 deletions

View File

@ -244,11 +244,8 @@ exports.force_get_events = function force_get_events() {
};
exports.home_view_loaded = function home_view_loaded() {
if (!waiting_on_homeview_load) {
return;
}
waiting_on_homeview_load = false;
exports.get_events();
$(document).trigger("home_view_loaded.zulip");
};

View File

@ -965,10 +965,6 @@ function get_old_messages_success(data, opts) {
process_result(data.messages, opts);
ui.resize_bottom_whitespace();
if (opts.msg_list === home_msg_list) {
server_events.home_view_loaded();
}
}
function load_old_messages(opts) {
@ -1182,8 +1178,8 @@ function main() {
return;
}
}
// now start subscribing to updates
server_events.get_events();
server_events.home_view_loaded();
// backfill more messages after the user is idle
var backfill_batch_size = 1000;
@ -1209,7 +1205,6 @@ function main() {
});
} else {
server_events.home_view_loaded();
server_events.get_events();
}
$(document).on('message_id_changed', function (event) {