Mark all messages in view as read when you hit the bottom.

Trac #1428

(imported from commit f40d890091528969ae4e4db80adb019cbce60fef)
This commit is contained in:
Kevin Mehall 2013-07-02 15:50:05 -04:00
parent e6b2acefe2
commit 0f6bdafea3
3 changed files with 16 additions and 9 deletions

View File

@ -44,7 +44,7 @@ var globals =
+ ' viewport restart_get_updates force_get_updates'
+ ' load_more_messages reset_load_more_status have_scrolled_away_from_top'
+ ' maybe_scroll_to_selected recenter_pointer_on_display suppress_scroll_pointer_update'
+ ' message_range message_in_table process_loaded_for_unread'
+ ' mark_current_list_as_read 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 unread_subjects'
+ ' add_message_metadata'

View File

@ -191,6 +191,7 @@ function process_hotkey(e) {
last_viewport_movement_direction = 1;
current_msg_list.select_id(next_id, {then_scroll: true,
from_scroll: true});
mark_current_list_as_read();
return true;
}
@ -213,6 +214,7 @@ function process_hotkey(e) {
// FIXME: this doesn't work for End because rows.last_visible()
// always returns a message.
viewport.scrollTop($("#main_div").outerHeight(true));
mark_current_list_as_read();
}
return true;
}
@ -245,6 +247,7 @@ function process_hotkey(e) {
case 'page_down':
if (viewport.at_bottom() && !current_msg_list.empty()) {
current_msg_list.select_id(current_msg_list.last().id, {then_scroll: false});
mark_current_list_as_read();
}
else {
ui.page_down_the_right_amount();

View File

@ -346,14 +346,14 @@ function process_read_messages(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 (unread.message_unread(msg)) {
mark_as_read.push(msg);
}
});
process_read_messages(mark_as_read);
var msgs_in_range = message_range(msg_list, start_id, end_id);
var unread_msgs = $.grep(msgs_in_range, unread.message_unread);
process_read_messages(unread_msgs);
}
function mark_current_list_as_read() {
var unread_msgs = $.grep(current_msg_list.all(), unread.message_unread);
process_read_messages(unread_msgs);
}
function update_pointer() {
@ -1195,6 +1195,10 @@ function move_pointer_at_page_top_and_bottom(delta) {
} else {
// We're scrolling down (we want more recent messages)
next_row = rows.next_visible(next_row);
if (next_row.length === 0) {
mark_current_list_as_read();
}
}
if (next_row.length !== 0) {
current_msg_list.select_id(rows.id(next_row));