mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
pointer: Merge pointer.js into message_scroll.js.
Ths remaining code here is naturally message scrolling logic, and fits well into the existing file for handling that.
This commit is contained in:
@@ -158,6 +158,26 @@ exports.initialize = function () {
|
||||
unread_ops.process_visible();
|
||||
scroll_finish();
|
||||
}, 50));
|
||||
|
||||
// Scroll handler that marks messages as read when you scroll past them.
|
||||
$(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'});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user