mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 15:33:30 +00:00
unread_ops: Use the improved /messages/flags API to mark all as read.
Fixes #23406. Fixes #14053. This also uses the new alert banner system. It is not clear if we want to scroll user to the end of the narrow after this update is complete. There is a "scroll to bottom" button for users who want to be placed at the end of the narrow but there is no reverse option for users who don't. So, maybe not changing the scroll position is preferred especially since we now use banners for the update where a user could have been reading something while we were updating the message flags in the background. We do not handle the case of `mark as read` and `mark as unread` both running in batches at the same (This is a somewhat rare case given the high cap on `NUM_OF_MESSAGES_UPDATED_PER_BATCH` but possible.). `unread.declare_bankruptcy` is no longer used in the code but we keep it since it is used extensively in tests.
This commit is contained in:
@@ -24,12 +24,17 @@ import * as util from "./util";
|
||||
// for more details on how this system is designed.
|
||||
|
||||
export let messages_read_in_narrow = false;
|
||||
export let old_unreads_missing = false;
|
||||
|
||||
export function set_messages_read_in_narrow(value) {
|
||||
messages_read_in_narrow = value;
|
||||
}
|
||||
|
||||
export let old_unreads_missing = false;
|
||||
|
||||
export function clear_old_unreads_missing() {
|
||||
old_unreads_missing = false;
|
||||
}
|
||||
|
||||
export const unread_mentions_counter = new Set();
|
||||
const unread_messages = new Set();
|
||||
|
||||
@@ -672,6 +677,7 @@ export function mark_as_read(message_id) {
|
||||
}
|
||||
|
||||
export function declare_bankruptcy() {
|
||||
// Only used in tests.
|
||||
unread_pm_counter.clear();
|
||||
unread_topic_counter.clear();
|
||||
unread_mentions_counter.clear();
|
||||
|
||||
Reference in New Issue
Block a user