mirror of https://github.com/zulip/zulip.git
pointer.js: Add setter for furthest_read.
After migration to an ES6 module, `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
6e4ae95994
commit
055ebe76aa
|
@ -203,6 +203,7 @@ run_test('message_id_change', () => {
|
|||
|
||||
set_global('pointer', {
|
||||
furthest_read: 401,
|
||||
set_furthest_read: function (value) { this.furthest_read = value; },
|
||||
});
|
||||
|
||||
set_global('message_list', {});
|
||||
|
|
|
@ -67,6 +67,9 @@ run_test('pointer_event', () => {
|
|||
};
|
||||
|
||||
global.pointer.furthest_read = 0;
|
||||
global.pointer.set_furthest_read = function (value) {
|
||||
this.furthest_read = value;
|
||||
};
|
||||
global.pointer.server_furthest_read = 0;
|
||||
server_events._get_events_success([event]);
|
||||
assert.equal(global.pointer.furthest_read, event.pointer);
|
||||
|
|
|
@ -176,7 +176,7 @@ exports.reify_message_id = function (opts) {
|
|||
var old_id = opts.old_id;
|
||||
var new_id = opts.new_id;
|
||||
if (pointer.furthest_read === old_id) {
|
||||
pointer.furthest_read = new_id;
|
||||
pointer.set_furthest_read(new_id);
|
||||
}
|
||||
if (stored_messages[old_id]) {
|
||||
stored_messages[new_id] = stored_messages[old_id];
|
||||
|
|
|
@ -11,6 +11,9 @@ exports.recenter_pointer_on_display = false;
|
|||
// when All Messages is next clicked by the user
|
||||
exports.suppress_scroll_pointer_update = false;
|
||||
exports.furthest_read = -1;
|
||||
exports.set_furthest_read = function (value) {
|
||||
exports.furthest_read = value;
|
||||
};
|
||||
exports.server_furthest_read = -1;
|
||||
|
||||
var pointer_update_in_flight = false;
|
||||
|
|
|
@ -133,7 +133,7 @@ function get_events_success(events) {
|
|||
|
||||
if (new_pointer !== undefined
|
||||
&& new_pointer > pointer.furthest_read) {
|
||||
pointer.furthest_read = new_pointer;
|
||||
pointer.set_furthest_read(new_pointer);
|
||||
pointer.server_furthest_read = new_pointer;
|
||||
home_msg_list.select_id(new_pointer, {then_scroll: true, use_closest: true});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue