buddy_list: Set html instead of append for view all users link.

Fixes https://chat.zulip.org/#narrow/channel/9-issues/topic/buddy.20list.20view.20all.20users.20appears.20twice
Earlier, we were appending view all users link using JQuery.append, so
when `render_view_user_list_links` is called twice, `view all users`
appears twice. It is better to have the link div in right_sidebar.hbs
and then insert the html when required.
This commit is contained in:
Shubham Padia
2025-06-05 07:42:08 +00:00
committed by Tim Abbott
parent b31d3ce5b9
commit 90a1f0f7aa
4 changed files with 11 additions and 10 deletions

View File

@@ -367,7 +367,7 @@ export class BuddyList extends BuddyListConf {
// 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();
$("#buddy-list-other-users-container .view-all-users-link").empty();
void this.render_view_user_list_links();
this.display_or_hide_sections();
void this.update_empty_list_placeholders();
@@ -758,7 +758,9 @@ export class BuddyList extends BuddyListConf {
// We give a link to view the list of all users to help reduce confusion about
// there being hidden (inactive) "other" users.
if (has_inactive_other_users) {
$("#buddy-list-other-users-container").append($(render_view_all_users()));
$("#buddy-list-other-users-container .view-all-users-link").html(
render_view_all_users(),
);
}
// Note that we don't show a link for the participants list because we expect

View File

@@ -1,7 +1,5 @@
<div class="buddy-list-user-link view-all-users-link">
<a class="right-sidebar-wrappable-text-container" href="#organization/users">
<span class="right-sidebar-wrappable-text-inner">
{{t "View all users" }}
</span>
</a>
</div>

View File

@@ -24,6 +24,7 @@
<div id="buddy-list-other-users-container" class="buddy-list-section-container">
<div class="buddy-list-subsection-header"></div>
<ul id="buddy-list-other-users" class="buddy-list-section"></ul>
<div class="buddy-list-user-link view-all-users-link"></div>
</div>
<div id="buddy_list_wrapper_padding"></div>
<div class="invite-user-shortcut">

View File

@@ -42,7 +42,7 @@ exports.stub_buddy_list_elements = () => {
$("#buddy-list-other-users .empty-list-message").length = 0;
$("#buddy-list-other-users-container .view-all-users-link").length = 0;
$("#buddy-list-users-matching-view-container .view-all-subscribers-link").remove = noop;
$("#buddy-list-other-users-container .view-all-users-link").remove = noop;
$("#buddy-list-other-users-container .view-all-users-link").empty = noop;
$(`#buddy-list-users-matching-view .empty-list-message`).remove = noop;
$(`#buddy-list-other-users .empty-list-message`).remove = noop;
$(`#buddy-list-participants .empty-list-message`).remove = noop;