mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
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:
@@ -18,6 +18,7 @@ import * as message_util from "./message_util";
|
|||||||
import * as message_view_header from "./message_view_header";
|
import * as message_view_header from "./message_view_header";
|
||||||
import * as narrow from "./narrow";
|
import * as narrow from "./narrow";
|
||||||
import * as narrow_state from "./narrow_state";
|
import * as narrow_state from "./narrow_state";
|
||||||
|
import * as navbar_alerts from "./navbar_alerts";
|
||||||
import * as navigate from "./navigate";
|
import * as navigate from "./navigate";
|
||||||
import {page_params} from "./page_params";
|
import {page_params} from "./page_params";
|
||||||
import * as people from "./people";
|
import * as people from "./people";
|
||||||
@@ -43,6 +44,7 @@ import * as user_status from "./user_status";
|
|||||||
import * as user_topics from "./user_topics";
|
import * as user_topics from "./user_topics";
|
||||||
|
|
||||||
let topics_widget;
|
let topics_widget;
|
||||||
|
let message_list_displayed_before;
|
||||||
// Sets the number of avatars to display.
|
// Sets the number of avatars to display.
|
||||||
// Rest of the avatars, if present, are displayed as {+x}
|
// Rest of the avatars, if present, are displayed as {+x}
|
||||||
const MAX_AVATAR = 4;
|
const MAX_AVATAR = 4;
|
||||||
@@ -893,8 +895,16 @@ export function hide() {
|
|||||||
// before it completely re-rerenders.
|
// before it completely re-rerenders.
|
||||||
message_view_header.render_title_area();
|
message_view_header.render_title_area();
|
||||||
|
|
||||||
// Fire our custom event
|
if (!message_list_displayed_before) {
|
||||||
$("#message_feed_container").trigger("message_feed_shown");
|
// 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.
|
||||||
|
message_list_displayed_before = true;
|
||||||
|
navbar_alerts.resize_app();
|
||||||
|
}
|
||||||
|
|
||||||
// This makes sure user lands on the selected message
|
// This makes sure user lands on the selected message
|
||||||
// and not always at the top of the narrow.
|
// and not always at the top of the narrow.
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import * as message_viewport from "./message_viewport";
|
|||||||
import * as navbar_alerts from "./navbar_alerts";
|
import * as navbar_alerts from "./navbar_alerts";
|
||||||
import * as navigate from "./navigate";
|
import * as navigate from "./navigate";
|
||||||
import * as popovers from "./popovers";
|
import * as popovers from "./popovers";
|
||||||
import * as recent_topics_util from "./recent_topics_util";
|
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
|
|
||||||
function get_new_heights() {
|
function get_new_heights() {
|
||||||
@@ -185,28 +184,3 @@ export function handler() {
|
|||||||
navigate.scroll_to_selected();
|
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();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -671,7 +671,6 @@ export function initialize_everything() {
|
|||||||
|
|
||||||
// All overlays must be initialized before hashchange.js
|
// All overlays must be initialized before hashchange.js
|
||||||
hashchange.initialize();
|
hashchange.initialize();
|
||||||
resize.initialize();
|
|
||||||
|
|
||||||
unread_ui.initialize();
|
unread_ui.initialize();
|
||||||
activity.initialize();
|
activity.initialize();
|
||||||
|
|||||||
Reference in New Issue
Block a user