Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stream_topic_history: Use first_including_muted for the oldest message.
Prakhar Pratyushf94d3bd4a21e
diff --git a/web/src/stream_topic_history.ts b/web/src/stream_topic_history.tsindex e9d384e2be5..32aeefe406a 100644--- a/web/src/stream_topic_history.ts+++ b/web/src/stream_topic_history.ts@@ -50,7 +50,7 @@ export function all_topics_in_cache(sub: StreamSubscription): boolean {// message ID in the stream; if it's older, we're good, otherwise,// we might be missing the oldest topics in this stream in our// cache.- const first_cached_message = all_messages_data.first();+ const first_cached_message = all_messages_data.first_including_muted();return first_cached_message!.id <= sub.first_message_id;}diff --git a/web/tests/stream_topic_history.test.cjs b/web/tests/stream_topic_history.test.cjsindex aca6bc765cd..cb79ac6e160 100644--- a/web/tests/stream_topic_history.test.cjs+++ b/web/tests/stream_topic_history.test.cjs@@ -144,13 +144,15 @@ test("is_complete_for_stream_id", ({override_rewire}) => {fetch_status: {has_found_newest: () => true,},- first: () => ({id: 5}),+ first_including_muted: () => ({id: 5}),});assert.equal(stream_topic_history.is_complete_for_stream_id(sub.stream_id), true);// Now simulate a more recent message id.- all_messages_data.all_messages_data.first = () => ({id: sub.first_message_id + 1});+ all_messages_data.all_messages_data.first_including_muted = () => ({+ id: sub.first_message_id + 1,+ });// Note that we'll return `true` here due to// fetched_stream_ids having the stream_id now.