buddy_list: Render view user links after filling screen.

We need to have the lists of rendered users so we can check if
we should be showing the links. This commit fixes a bug where
we showed the "view all subscribers" link even if all subscribers
were visible on the screen.
This commit is contained in:
evykassirer
2024-11-27 10:27:45 -08:00
committed by Tim Abbott
parent d0c402ac0f
commit c17babd0e7

View File

@@ -281,13 +281,10 @@ export class BuddyList extends BuddyListConf {
// in already-sorted order.
this.all_user_ids = opts.all_user_ids;
$("#buddy-list-users-matching-view-container .view-all-subscribers-link").remove();
$("#buddy-list-other-users-container .view-all-users-link").remove();
if (buddy_data.get_is_searching_users()) {
// Show all sections when searching users
this.set_section_collapse(".buddy-list-section-container", false);
} else {
this.render_view_user_list_links();
this.set_section_collapse(
"#buddy-list-participants-container",
this.participants_is_collapsed,
@@ -314,6 +311,13 @@ export class BuddyList extends BuddyListConf {
this.update_empty_list_placeholders();
this.fill_screen_with_content();
// This must happen after `fill_screen_with_content`
$("#buddy-list-users-matching-view-container .view-all-subscribers-link").remove();
$("#buddy-list-other-users-container .view-all-users-link").remove();
if (!buddy_data.get_is_searching_users()) {
this.render_view_user_list_links();
}
// `populate` always rerenders all user rows, so we need new load handlers.
// This logic only does something is a user has enabled the setting to
// view avatars in the buddy list, and otherwise the jQuery selector will