condense: Re-condense all messages on window resize.

Previously, if you started out with a very small window, loaded the
Zulip webapp, and then resized the window to be larger, you'd get the
condensed "[More]" links on essentially every message.  This failure
mode was most visible with multi-protocol Electron apps like Rambox
that would sloppily start with a tiny window and then resize it when
loading Zulip.

The Rambox experience was essential to our being able to track this
down; once we knew what was happening, the fix was simply to
re-compute the condense state on resize.

Commit message rewritten by tabbott to explain the debugging and
context involved here, since this was one of our longest-lived mystery
bugs.

Fixes #5312.
This commit is contained in:
Puneeth Chaganti
2018-03-26 22:56:24 +05:30
committed by Tim Abbott
parent 3b29d00c69
commit 97b90c1e87

View File

@@ -277,6 +277,9 @@ exports.handler = function () {
popovers.hide_all();
exports.resize_page_components();
// Re-compute and display/remove [More] links to messages
condense.condense_and_collapse($("div.message_row"));
// This function might run onReady (if we're in a narrow window),
// but before we've loaded in the messages; in that case, don't
// try to scroll to one.