mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 23:43:43 +00:00
So here's the reproduction recipe: (1) Find a narrow that doesn't have any messages since 4 days ago (2) Directly visit that narrow in your browser (or wait for someone to do a deploy and thus auto-reload) (3) Wait until load_old_messages has been called at least once (4) Un-narrow (5) Scroll up, and notice that the 400 most recent messages are above sets of older messages. The cause is that the code in add_messages assumed that selected_message_id was within the range of message already in the home view. This is true in most cases where add_message is being called, but it is not true in the case that the user was in a narrowed view containing only very old messages (And thus selected_message_id would be older than everything in the home view). We can fix this by tracking persistent_message_id separately and using that for the relevant test in add_messages. (imported from commit f0da2561ba68f729343b260adc398029fae6acf7)