mirror of https://github.com/zulip/zulip.git
unread: Extract old_unreads_missing.
This avoids post-initialization access to page_params inside unread.js. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
parent
79b8219797
commit
6f4047c679
|
@ -1,7 +1,6 @@
|
||||||
import * as blueslip from "./blueslip";
|
import * as blueslip from "./blueslip";
|
||||||
import {FoldDict} from "./fold_dict";
|
import {FoldDict} from "./fold_dict";
|
||||||
import * as message_store from "./message_store";
|
import * as message_store from "./message_store";
|
||||||
import {page_params} from "./page_params";
|
|
||||||
import * as people from "./people";
|
import * as people from "./people";
|
||||||
import * as recent_topics_ui from "./recent_topics_ui";
|
import * as recent_topics_ui from "./recent_topics_ui";
|
||||||
import * as recent_topics_util from "./recent_topics_util";
|
import * as recent_topics_util from "./recent_topics_util";
|
||||||
|
@ -25,6 +24,7 @@ import * as util from "./util";
|
||||||
// for more details on how this system is designed.
|
// for more details on how this system is designed.
|
||||||
|
|
||||||
export let messages_read_in_narrow = false;
|
export let messages_read_in_narrow = false;
|
||||||
|
export let old_unreads_missing = false;
|
||||||
|
|
||||||
export function set_messages_read_in_narrow(value) {
|
export function set_messages_read_in_narrow(value) {
|
||||||
messages_read_in_narrow = value;
|
messages_read_in_narrow = value;
|
||||||
|
@ -560,7 +560,7 @@ export function process_loaded_messages(messages, expect_no_new_unreads = false)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expect_no_new_unreads && !page_params.unread_msgs.old_unreads_missing) {
|
if (expect_no_new_unreads && !old_unreads_missing) {
|
||||||
// This may happen due to races, where someone narrows
|
// This may happen due to races, where someone narrows
|
||||||
// to a view and the message_fetch request returns
|
// to a view and the message_fetch request returns
|
||||||
// before server_events system delivers the message to
|
// before server_events system delivers the message to
|
||||||
|
@ -796,6 +796,7 @@ export function get_msg_ids_for_starred() {
|
||||||
export function initialize(params) {
|
export function initialize(params) {
|
||||||
const unread_msgs = params.unread_msgs;
|
const unread_msgs = params.unread_msgs;
|
||||||
|
|
||||||
|
old_unreads_missing = unread_msgs.old_unreads_missing;
|
||||||
unread_pm_counter.set_huddles(unread_msgs.huddles);
|
unread_pm_counter.set_huddles(unread_msgs.huddles);
|
||||||
unread_pm_counter.set_pms(unread_msgs.pms);
|
unread_pm_counter.set_pms(unread_msgs.pms);
|
||||||
unread_topic_counter.set_streams(unread_msgs.streams);
|
unread_topic_counter.set_streams(unread_msgs.streams);
|
||||||
|
|
Loading…
Reference in New Issue