mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 10:26:28 +00:00
recent-conversations: Update logic for processing messages.
As of 550a32b, when private messages were added to recent
conversations, `recent_topics_data.process_message` will
always return true.
Updates `recent_topics_data.process_message` for no return
value. Also, removes the `topic_data_changed` logic from
`recent_topics_ui.process_messages` and instead checks for
messages to process before updating the data and calling the
rerender.
`recent_topics_ui.complete_rerender` first checks for whether
the recent conversations view is visible before rerendering.
This commit is contained in:
committed by
Tim Abbott
parent
5c833f0423
commit
79c0d7fbab
@@ -298,17 +298,10 @@ export function process_messages(messages) {
|
||||
// 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.
|
||||
//
|
||||
// Only rerender if topic_data actually
|
||||
// changed.
|
||||
let topic_data_changed = false;
|
||||
for (const msg of messages) {
|
||||
if (process_message(msg)) {
|
||||
topic_data_changed = true;
|
||||
if (messages.length > 0) {
|
||||
for (const msg of messages) {
|
||||
process_message(msg);
|
||||
}
|
||||
}
|
||||
|
||||
if (topic_data_changed) {
|
||||
complete_rerender();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user