From f27edcd50af01eacfc3499e4052ac38bcabebe59 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 30 Jan 2014 14:32:13 -0500 Subject: [PATCH] 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) --- static/js/server_events.js | 5 +---- static/js/zulip.js | 9 ++------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/static/js/server_events.js b/static/js/server_events.js index 97f1fa0b4a..34fefd7cf4 100644 --- a/static/js/server_events.js +++ b/static/js/server_events.js @@ -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"); }; diff --git a/static/js/zulip.js b/static/js/zulip.js index 4e7e7f9fc6..b1b6aad75e 100644 --- a/static/js/zulip.js +++ b/static/js/zulip.js @@ -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) {