diff --git a/frontend_tests/node_tests/server_events.js b/frontend_tests/node_tests/server_events.js index 9e241bf6e6..dd90adf936 100644 --- a/frontend_tests/node_tests/server_events.js +++ b/frontend_tests/node_tests/server_events.js @@ -71,6 +71,9 @@ run_test('pointer_event', () => { this.furthest_read = value; }; global.pointer.server_furthest_read = 0; + global.pointer.set_server_furthest_read = function (value) { + this.server_furthest_read = value; + }; server_events._get_events_success([event]); assert.equal(global.pointer.furthest_read, event.pointer); assert.equal(global.pointer.server_furthest_read, event.pointer); diff --git a/static/js/pointer.js b/static/js/pointer.js index b95a34ea39..a72aa90bc9 100644 --- a/static/js/pointer.js +++ b/static/js/pointer.js @@ -18,6 +18,9 @@ exports.set_furthest_read = function (value) { exports.furthest_read = value; }; exports.server_furthest_read = -1; +exports.set_server_furthest_read = function (value) { + exports.server_furthest_read = value; +}; var pointer_update_in_flight = false; diff --git a/static/js/server_events.js b/static/js/server_events.js index 0b00b72797..f7b7ba7837 100644 --- a/static/js/server_events.js +++ b/static/js/server_events.js @@ -134,7 +134,7 @@ function get_events_success(events) { if (new_pointer !== undefined && new_pointer > pointer.furthest_read) { pointer.set_furthest_read(new_pointer); - pointer.server_furthest_read = new_pointer; + pointer.set_server_furthest_read(new_pointer); home_msg_list.select_id(new_pointer, {then_scroll: true, use_closest: true}); }