mirror of https://github.com/zulip/zulip.git
pointer.js: Add setter for server_furthest_read.
After migration to an ES6 module, `server_furthest_read` would no longer be mutable from outside the module. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
parent
e559662c8c
commit
f9bf414b58
|
@ -71,6 +71,9 @@ run_test('pointer_event', () => {
|
||||||
this.furthest_read = value;
|
this.furthest_read = value;
|
||||||
};
|
};
|
||||||
global.pointer.server_furthest_read = 0;
|
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]);
|
server_events._get_events_success([event]);
|
||||||
assert.equal(global.pointer.furthest_read, event.pointer);
|
assert.equal(global.pointer.furthest_read, event.pointer);
|
||||||
assert.equal(global.pointer.server_furthest_read, event.pointer);
|
assert.equal(global.pointer.server_furthest_read, event.pointer);
|
||||||
|
|
|
@ -18,6 +18,9 @@ exports.set_furthest_read = function (value) {
|
||||||
exports.furthest_read = value;
|
exports.furthest_read = value;
|
||||||
};
|
};
|
||||||
exports.server_furthest_read = -1;
|
exports.server_furthest_read = -1;
|
||||||
|
exports.set_server_furthest_read = function (value) {
|
||||||
|
exports.server_furthest_read = value;
|
||||||
|
};
|
||||||
|
|
||||||
var pointer_update_in_flight = false;
|
var pointer_update_in_flight = false;
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ function get_events_success(events) {
|
||||||
if (new_pointer !== undefined
|
if (new_pointer !== undefined
|
||||||
&& new_pointer > pointer.furthest_read) {
|
&& new_pointer > pointer.furthest_read) {
|
||||||
pointer.set_furthest_read(new_pointer);
|
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});
|
home_msg_list.select_id(new_pointer, {then_scroll: true, use_closest: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue