mirror of https://github.com/zulip/zulip.git
Get initial server generation from first get_updates result
Embedding this in index.html won't work anymore, because the Django FastCGI and the Tornado servers might have been started at different times. (imported from commit 187909d0593449cf2989857671f9ca526723e451)
This commit is contained in:
parent
94f107e281
commit
91209f9304
|
@ -41,7 +41,6 @@
|
|||
|
||||
{# Not escaped, because it's guaranteed by the model to be an integer. #}
|
||||
var initial_pointer = {{ user_profile.pointer }};
|
||||
var server_generation = {{ server_generation }};
|
||||
|
||||
var email = "{{ user_profile.user.email|escapejs }}";
|
||||
var have_initial_messages = {{ have_initial_messages|escapejs }};
|
||||
|
|
|
@ -7,7 +7,6 @@ var globals =
|
|||
|
||||
// index.html
|
||||
+ ' initial_pointer email stream_list people_list have_initial_messages'
|
||||
+ ' server_generation'
|
||||
|
||||
// compose.js
|
||||
+ ' show_compose hide_compose toggle_compose clear_compose_box compose_button'
|
||||
|
|
|
@ -72,9 +72,6 @@ $(function () {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
$(function () { get_updates_params.server_generation = server_generation; });
|
||||
|
||||
// The "message groups", i.e. blocks of messages collapsed by recipient.
|
||||
// Each message table has a list of lists.
|
||||
var message_groups = {
|
||||
|
@ -609,7 +606,9 @@ function get_updates() {
|
|||
get_updates_params.failures = 0;
|
||||
$('#connection-error').hide();
|
||||
|
||||
if (data.server_generation !== get_updates_params.server_generation) {
|
||||
if (get_updates_params.server_generation === -1) {
|
||||
get_updates_params.server_generation = data.server_generation;
|
||||
} else if (data.server_generation !== get_updates_params.server_generation) {
|
||||
get_updates_params.reload_pending = true;
|
||||
reload_app();
|
||||
}
|
||||
|
|
|
@ -192,8 +192,7 @@ def home(request):
|
|||
'have_initial_messages':
|
||||
'true' if num_messages > 0 else 'false',
|
||||
'show_debug':
|
||||
settings.DEBUG and ('show_debug' in request.GET),
|
||||
'server_generation': SERVER_GENERATION},
|
||||
settings.DEBUG and ('show_debug' in request.GET) },
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
@login_required_json_view
|
||||
|
|
Loading…
Reference in New Issue