Re-enable pointer sync

(imported from commit 9f765bbc32e6a3fd91e83aa4016c8e8f8c47bfc1)
This commit is contained in:
Zev Benjamin 2012-10-29 17:02:10 -04:00
parent 71a2cc6611
commit fbe41c95d5
2 changed files with 14 additions and 25 deletions

View File

@ -599,13 +599,12 @@ function get_updates(options) {
$('#zephyr-mirror-error').hide(); $('#zephyr-mirror-error').hide();
} }
// Pointer sync is disabled for now if (data.new_pointer !== undefined
// if (data.new_pointer !== undefined && data.new_pointer !== selected_message_id)
// && data.new_pointer !== selected_message_id) {
// { select_message_by_id(data.new_pointer,
// select_message_by_id(data.new_pointer, {then_scroll: true, update_server: false});
// {then_scroll: true, update_server: false}); }
// }
// Pause for 25 milliseconds before restarting the request. // Pause for 25 milliseconds before restarting the request.
// This gives the browser (especially, our frontend test browser) // This gives the browser (especially, our frontend test browser)

View File

@ -347,7 +347,8 @@ def format_delayed_updates_response(request=None, user_profile=None,
def return_messages_immediately(user_profile, client_id, last, def return_messages_immediately(user_profile, client_id, last,
failures, client_server_generation, failures, client_server_generation,
client_reload_pending, dont_block, **kwargs): client_reload_pending, client_pointer,
dont_block, **kwargs):
if last is None: if last is None:
# When an API user is first querying the server to subscribe, # When an API user is first querying the server to subscribe,
# there's no reason to reply immediately. # there's no reason to reply immediately.
@ -361,19 +362,8 @@ def return_messages_immediately(user_profile, client_id, last,
if last < 0: if last < 0:
return {"msg": "Invalid 'last' argument", "result": "error"} return {"msg": "Invalid 'last' argument", "result": "error"}
# Pointer sync is disabled for now
# client_pointer = request.POST.get("pointer")
# Pointer sync is disabled for now
# client_wants_ptr_updates = False
# if client_pointer is not None:
# client_pointer = int(client_pointer)
# client_wants_ptr_updates = True
new_pointer = None new_pointer = None
query = Message.objects.select_related().filter(usermessage__user_profile = user_profile).order_by('id') query = Message.objects.select_related().filter(usermessage__user_profile = user_profile).order_by('id')
# Pointer sync is disabled for now
# ptr = user_profile.pointer
messages = query.filter(id__gt=last)[:400] messages = query.filter(id__gt=last)[:400]
@ -398,12 +388,10 @@ def return_messages_immediately(user_profile, client_id, last,
and not client_reload_pending): and not client_reload_pending):
update_types.append("client_reload") update_types.append("client_reload")
# Pointer sync is disabled for now ptr = user_profile.pointer
# if (client_wants_ptr_updates if (client_pointer is not None and ptr != client_pointer):
# and str(user_profile.last_pointer_updater) != str(client_id) new_pointer = ptr
# and ptr != client_pointer): update_types.append("pointer_update")
# new_pointer = ptr
# update_types.append("pointer_update")
if failures >= 1: if failures >= 1:
update_types.append("reset_failure_counter") update_types.append("reset_failure_counter")
@ -439,11 +427,13 @@ def get_updates_backend(request, user_profile, handler, client_id,
failures = POST(converter=int, default=None), failures = POST(converter=int, default=None),
client_server_generation = POST(whence='server_generation', default=None), client_server_generation = POST(whence='server_generation', default=None),
client_reload_pending = POST(whence='server_generation', default=None), client_reload_pending = POST(whence='server_generation', default=None),
client_pointer = POST(whence='pointer', converter=int, default=None),
dont_block = POST(converter=simplejson.loads, default=False), dont_block = POST(converter=simplejson.loads, default=False),
**kwargs): **kwargs):
resp = return_messages_immediately(user_profile, client_id, last, failures, resp = return_messages_immediately(user_profile, client_id, last, failures,
client_server_generation, client_server_generation,
client_reload_pending, client_reload_pending,
client_pointer,
dont_block, **kwargs) dont_block, **kwargs)
if resp is not None: if resp is not None:
send_with_safety_check(resp, handler, **kwargs) send_with_safety_check(resp, handler, **kwargs)