Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

Revert "recent_view_ui: Avoid non-contiguous rows in recent view."

Anders Kaseorg8ebcaddfd9d5
diff --git a/web/src/message_fetch.js b/web/src/message_fetch.js
index c941104a555..d8e0a513fb5 100644
--- a/web/src/message_fetch.js
+++ b/web/src/message_fetch.js
@@ -61,11 +61,9 @@ function process_result(data, opts) {
}
}
- if (messages.length > 0 && (opts.msg_list === message_lists.home || opts.is_recent_view_data)) {
- recent_view_ui.process_messages(messages);
-
- // Update the recent view UI's understanding of which messages
- // we have available for the recent view.
+ if (messages.length > 0 && opts.msg_list === message_lists.home) {
+ // We keep track of how far back we've fetched messages for, for messaging in
+ // the recent view. This assumes `data.messages` is already sorted.
const oldest_timestamp = all_messages_data.first().timestamp;
recent_view_ui.set_oldest_message_date(
oldest_timestamp,
@@ -75,6 +73,7 @@ function process_result(data, opts) {
}
huddle_data.process_loaded_messages(messages);
+ recent_view_ui.process_messages(messages);
stream_list.update_streams_sidebar();
stream_list.maybe_scroll_narrow_into_view();
@@ -592,7 +591,6 @@ export function initialize(home_view_loaded) {
num_before: consts.recent_view_initial_fetch_size,
num_after: 0,
msg_list_data: recent_view_message_list_data,
- is_recent_view_data: true,
cont: recent_view_ui.hide_loading_indicator,
});
}
diff --git a/web/src/recent_view_ui.js b/web/src/recent_view_ui.js
index 57a720d8c5a..d8322dba107 100644
--- a/web/src/recent_view_ui.js
+++ b/web/src/recent_view_ui.js
@@ -370,15 +370,10 @@ export function hide_loading_indicator() {
}
export function process_messages(messages) {
- // This code path processes messages from 3 sources:
-
- // 1. Newly sent messages from the server_events system. This is safe to
- // process because we always will have the latest previously sent messages.
- // 2. Messages in all_messages_data, the main cache of contiguous
- // message history that the client maintains.
- // 3. Latest messages fetched specifically for Recent view when
- // the browser first loads. We will be able to remove this once
- // all_messages_data is fetched in a better order.
+ // While this is inexpensive and handles all the cases itself,
+ // the UX can be bad if user wants to scroll down the list as
+ // the UI will be returned to the beginning of the list on every
+ // update.
let conversation_data_updated = false;
if (messages.length > 0) {
for (const msg of messages) {