Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

resize: Remove height of hidden elements from buddy list height.

Aman Agrawalf26b00062190
diff --git a/web/src/resize.ts b/web/src/resize.ts
index 7ba7f08b0c7..95e6574d3e5 100644
--- a/web/src/resize.ts
+++ b/web/src/resize.ts
@@ -16,7 +16,13 @@ function get_new_heights(): {
buddy_list_wrapper_max_height: number;
} {
const viewport_height = message_viewport.height();
- const right_sidebar_shortcuts_height = $(".right-sidebar-shortcuts").outerHeight(true) ?? 0;
+
+ // If invite user link is not displayed, `.right-sidebar-shortcuts` is displayed with just
+ // margin which we don't want to consider in height calculation of buddy list.
+ let right_sidebar_shortcuts_height = 0;
+ if ($("#right-sidebar .invite-user-link").css("display") !== "none") {
+ right_sidebar_shortcuts_height = $(".right-sidebar-shortcuts").outerHeight(true) ?? 0;
+ }
let stream_filters_max_height =
viewport_height -
@@ -35,7 +41,7 @@ function get_new_heights(): {
viewport_height -
Number.parseInt($("#right-sidebar").css("paddingTop"), 10) -
($("#userlist-header").outerHeight(true) ?? 0) -
- ($("#user_search_section").outerHeight(true) ?? 0) -
+ ($("#user_search_section:not(.notdisplayed)").outerHeight(true) ?? 0) -
right_sidebar_shortcuts_height;
const buddy_list_wrapper_max_height = Math.max(80, usable_height);