mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 07:52:19 +00:00
Since we are no longer using the "pointer" value sent in page_params.pointer for anything, there's no value in continuing to send it from the server to the client. The remaining code in pointer.js is logic managing state for the currently selected message.
38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
// See https://zulip.readthedocs.io/en/latest/subsystems/pointer.html for notes on
|
|
// how this system is designed.
|
|
|
|
exports.recenter_pointer_on_display = false;
|
|
exports.set_recenter_pointer_on_display = function (value) {
|
|
exports.recenter_pointer_on_display = value;
|
|
};
|
|
|
|
// Toggles re-centering the pointer in the window
|
|
// when All Messages is next clicked by the user
|
|
exports.suppress_scroll_pointer_update = false;
|
|
exports.set_suppress_scroll_pointer_update = function (value) {
|
|
exports.suppress_scroll_pointer_update = value;
|
|
};
|
|
|
|
exports.initialize = function initialize() {
|
|
$(document).on('message_selected.zulip', function (event) {
|
|
if (event.id === -1) {
|
|
return;
|
|
}
|
|
|
|
if (event.mark_read && event.previously_selected !== -1) {
|
|
// Mark messages between old pointer and new pointer as read
|
|
let messages;
|
|
if (event.id < event.previously_selected) {
|
|
messages = event.msg_list.message_range(event.id, event.previously_selected);
|
|
} else {
|
|
messages = event.msg_list.message_range(event.previously_selected, event.id);
|
|
}
|
|
if (event.msg_list.can_mark_messages_read()) {
|
|
unread_ops.notify_server_messages_read(messages, {from: 'pointer'});
|
|
}
|
|
}
|
|
});
|
|
};
|
|
|
|
window.pointer = exports;
|