resize: Call resize_app after hiding recent topics first time.

See the code comment for why it is being called. We also remove the
unused `message_feed_shown` which was added to be used for this
purpose.

I decided to not call this with `requestAnimationFrame` since it
is changing position of elements in DOM and not letting browser
do a reflow after that can lead to wrong calculations later on.
This commit is contained in:
Aman Agrawal
2022-11-21 13:41:24 +00:00
committed by Tim Abbott
parent a0f42edaa2
commit fd422a4dd8
3 changed files with 12 additions and 29 deletions

View File

@@ -9,7 +9,6 @@ import * as message_viewport from "./message_viewport";
import * as navbar_alerts from "./navbar_alerts";
import * as navigate from "./navigate";
import * as popovers from "./popovers";
import * as recent_topics_util from "./recent_topics_util";
import * as util from "./util";
function get_new_heights() {
@@ -185,28 +184,3 @@ export function handler() {
navigate.scroll_to_selected();
}
}
export function initialize() {
// Hack: If the app is loaded directly to recent topics, then we
// need to arrange to call navbar_alerts.resize_app when we first
// visit a message list. This is a workaround for bugs where the
// floating recipient bar will be invisible (as well as other
// alignment issues) when they are initially rendered in the
// background because recent topics is displayed.
if (recent_topics_util.is_visible()) {
// We bind the handler for the message_feed_container shown event, such
// that it will only get executed once.
//
// The selector here is based on #gear-menu, to take advantage
// of the Bootstrap the 'show' event handler on that legacy
// data-toggle element.
$('#gear-menu a[data-toggle="tab"][href="#message_feed_container"]').one("show", () => {
// We use a requestAnimationFrame here to prevent this call from
// causing a forced reflow.
window.requestAnimationFrame(() => {
navbar_alerts.resize_app();
});
});
}
}