mirror of https://github.com/zulip/zulip.git
Mark messages as read when using the End key
(imported from commit b2495cb27b1362d037e786db7f108540f2ce655b)
This commit is contained in:
parent
de44f08772
commit
d0b8a2fd21
|
@ -42,7 +42,7 @@ var globals =
|
|||
+ ' maybe_scroll_to_selected recenter_pointer_on_display suppress_scroll_pointer_update'
|
||||
+ ' process_visible_unread_messages message_range message_in_table process_loaded_for_unread'
|
||||
+ ' mark_all_as_read message_unread process_read_messages unread_in_current_view'
|
||||
+ ' fast_forward_pointer recent_subjects'
|
||||
+ ' fast_forward_pointer recent_subjects mark_read_between'
|
||||
;
|
||||
|
||||
|
||||
|
|
|
@ -105,9 +105,13 @@ function process_hotkey(e) {
|
|||
}
|
||||
dirkey = directional_hotkeys_id[code];
|
||||
var next_id = dirkey.getid();
|
||||
var prev_id = current_msg_list.selected_id();
|
||||
last_viewport_movement_direction = dirkey.direction;
|
||||
current_msg_list.select_id(next_id, {then_scroll: true,
|
||||
from_scroll: true});
|
||||
if (prev_id !== -1 && next_id !== -1) {
|
||||
mark_read_between(current_msg_list, prev_id, next_id);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -573,14 +573,7 @@ $(function () {
|
|||
// Make the block not empty to appease jslint
|
||||
var ignored = true;
|
||||
} else if (new_selected > scroll_start_message) {
|
||||
var mark_as_read = [];
|
||||
$.each(message_range(current_msg_list, scroll_start_message, new_selected),
|
||||
function (idx, msg) {
|
||||
if (message_unread(msg)) {
|
||||
mark_as_read.push(msg);
|
||||
}
|
||||
});
|
||||
process_read_messages(mark_as_read);
|
||||
mark_read_between(current_msg_list, scroll_start_message, new_selected);
|
||||
}
|
||||
scroll_start_message = undefined;
|
||||
|
||||
|
|
|
@ -419,6 +419,17 @@ function process_visible_unread_messages() {
|
|||
}
|
||||
}
|
||||
|
||||
function mark_read_between(msg_list, start_id, end_id) {
|
||||
var mark_as_read = [];
|
||||
$.each(message_range(msg_list, start_id, end_id),
|
||||
function (idx, msg) {
|
||||
if (message_unread(msg)) {
|
||||
mark_as_read.push(msg);
|
||||
}
|
||||
});
|
||||
process_read_messages(mark_as_read);
|
||||
}
|
||||
|
||||
function send_pointer_update() {
|
||||
if (!pointer_update_in_flight &&
|
||||
furthest_read > server_furthest_read) {
|
||||
|
|
Loading…
Reference in New Issue