Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
message_fetch: Add an extra fetch for Recent Topics.
Tim Abbottebea17b9a660
diff --git a/static/js/message_fetch.js b/static/js/message_fetch.jsindex 480cc0f048a..34eca386c12 100644--- a/static/js/message_fetch.js+++ b/static/js/message_fetch.js@@ -11,6 +11,7 @@ const consts = {narrow_after: 50,num_before_home_anchor: 200,num_after_home_anchor: 200,+ recent_topics_initial_fetch_size: 400,backward_batch_size: 100,forward_batch_size: 100,catch_up_batch_size: 1000,@@ -426,6 +427,38 @@ exports.initialize = function () {msg_list: home_msg_list,cont: load_more,});++ // In addition to the algorithm above, which is designed to ensure+ // that we fetch all message history eventually starting with the+ // first unread message, we also need to ensure that the Recent+ // Topics page contains the very most recent threads on page load.+ //+ // Long term, we'll want to replace this with something that's+ // more performant (i.e. avoids this unnecessary extra fetch the+ // results of which are basically discarded) and better represents+ // more than a few hundred messages' history, but this strategy+ // allows "Recent Topics" to always show current data (with gaps)+ // on page load; the data will be complete once the algorithm+ // above catched up to present.+ //+ // (Users will see a weird artifact where Recent Topics has a gap+ // between E.g. 6 days ago and 37 days ago while the catchup+ // process runs, so this strategy still results in problematic+ // visual artifacts shortly after page load; just more forgiveable+ // ones).+ //+ // This MessageList is defined similarly to home_message_list,+ // without a `table_name` attached.+ const recent_topics_message_list = new message_list.MessageList({+ filter: new Filter([{operator: "in", operand: "home"}]),+ muting_enabled: true,+ });+ exports.load_messages({+ anchor: "newest",+ num_before: consts.recent_topics_initial_fetch_size,+ num_after: 0,+ msg_list: recent_topics_message_list,+ });};window.message_fetch = exports;