mirror of https://github.com/zulip/zulip.git
Refactor how we mark a message range as read.
The goal here is to make it so that we can do other stuff with the range of messages between two subsequent selections, besides marking them as read. (imported from commit f6eb07844fb2ccda195c9d4dfcdf1c15f3f40aff)
This commit is contained in:
parent
6217c1a3be
commit
41f744c3b8
|
@ -344,9 +344,8 @@ function process_visible_unread_messages(update_cursor) {
|
|||
}
|
||||
}
|
||||
|
||||
function mark_read_between(msg_list, start_id, end_id) {
|
||||
var msgs_in_range = message_range(msg_list, start_id, end_id);
|
||||
var unread_msgs = $.grep(msgs_in_range, unread.message_unread);
|
||||
function mark_messages_as_read(msg_list) {
|
||||
var unread_msgs = $.grep(msg_list, unread.message_unread);
|
||||
process_read_messages(unread_msgs);
|
||||
}
|
||||
|
||||
|
@ -466,11 +465,13 @@ $(function () {
|
|||
|
||||
if (event.mark_read && event.previously_selected !== -1) {
|
||||
// Mark messages between old pointer and new pointer as read
|
||||
var messages;
|
||||
if (event.id < event.previously_selected) {
|
||||
mark_read_between(event.msg_list, event.id, event.previously_selected);
|
||||
messages = message_range(event.msg_list, event.id, event.previously_selected);
|
||||
} else {
|
||||
mark_read_between(event.msg_list, event.previously_selected, event.id);
|
||||
messages = message_range(event.msg_list, event.previously_selected, event.id);
|
||||
}
|
||||
mark_messages_as_read(messages);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue