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.

buddy_list: Rename list element to not be named container.

evykassirercd5a61eb5244
diff --git a/web/src/activity_ui.ts b/web/src/activity_ui.ts
index a29e48d5b39..cd49215a906 100644
--- a/web/src/activity_ui.ts
+++ b/web/src/activity_ui.ts
@@ -127,8 +127,8 @@ export function build_user_sidebar(): number[] | undefined {
buddy_list.populate({all_user_ids});
- render_empty_user_list_message_if_needed(buddy_list.$users_matching_view_container);
- render_empty_user_list_message_if_needed(buddy_list.$other_users_container);
+ render_empty_user_list_message_if_needed(buddy_list.$users_matching_view_list);
+ render_empty_user_list_message_if_needed(buddy_list.$other_users_list);
return all_user_ids; // for testing
}
diff --git a/web/src/buddy_list.ts b/web/src/buddy_list.ts
index 9e4708f15cd..413c94e2b09 100644
--- a/web/src/buddy_list.ts
+++ b/web/src/buddy_list.ts
@@ -157,8 +157,8 @@ export class BuddyList extends BuddyListConf {
render_data = get_render_data();
// This is a bit of a hack to make sure we at least have
// an empty list to start, before we get the initial payload.
- $users_matching_view_container = $(this.matching_view_list_selector);
- $other_users_container = $(this.other_user_list_selector);
+ $users_matching_view_list = $(this.matching_view_list_selector);
+ $other_users_list = $(this.other_user_list_selector);
initialize_tooltips(): void {
$("#right-sidebar").on(
@@ -242,9 +242,9 @@ export class BuddyList extends BuddyListConf {
populate(opts: {all_user_ids: number[]}): void {
this.render_count = 0;
- this.$users_matching_view_container.empty();
+ this.$users_matching_view_list.empty();
this.users_matching_view_ids = [];
- this.$other_users_container.empty();
+ this.$other_users_list.empty();
this.other_user_ids = [];
// Reset data to be relevant for this current view.
@@ -454,26 +454,26 @@ export class BuddyList extends BuddyListConf {
$(`${this.matching_view_list_selector} .empty-list-message`).length > 0 &&
subscribed_users.length
) {
- this.$users_matching_view_container.empty();
+ this.$users_matching_view_list.empty();
}
const subscribed_users_html = this.items_to_html({
items: subscribed_users,
});
- this.$users_matching_view_container = $(this.matching_view_list_selector);
- this.$users_matching_view_container.append($(subscribed_users_html));
+ this.$users_matching_view_list = $(this.matching_view_list_selector);
+ this.$users_matching_view_list.append($(subscribed_users_html));
// Remove the empty list message before adding users
if (
$(`${this.other_user_list_selector} .empty-list-message`).length > 0 &&
other_users.length
) {
- this.$other_users_container.empty();
+ this.$other_users_list.empty();
}
const other_users_html = this.items_to_html({
items: other_users,
});
- this.$other_users_container = $(this.other_user_list_selector);
- this.$other_users_container.append($(other_users_html));
+ this.$other_users_list = $(this.other_user_list_selector);
+ this.$other_users_list.append($(other_users_html));
// Invariant: more_user_ids.length >= items.length.
// (Usually they're the same, but occasionally user ids
@@ -707,9 +707,9 @@ export class BuddyList extends BuddyListConf {
// This means we're inserting at the end
if (user_id_following_insertion === undefined) {
if (is_subscribed_user) {
- this.$users_matching_view_container.append($(html));
+ this.$users_matching_view_list.append($(html));
} else {
- this.$other_users_container.append($(html));
+ this.$other_users_list.append($(html));
}
} else {
const $li = this.find_li({key: user_id_following_insertion});
diff --git a/web/tests/activity.test.js b/web/tests/activity.test.js
index d6b9394bbd1..ec207ab5381 100644
--- a/web/tests/activity.test.js
+++ b/web/tests/activity.test.js
@@ -529,11 +529,11 @@ test("insert_one_user_into_empty_list", ({override, mock_template}) => {
});
let $users_matching_view_appended;
- override(buddy_list.$users_matching_view_container, "append", ($element) => {
+ override(buddy_list.$users_matching_view_list, "append", ($element) => {
$users_matching_view_appended = $element;
});
let $other_users_appended;
- override(buddy_list.$other_users_container, "append", ($element) => {
+ override(buddy_list.$other_users_list, "append", ($element) => {
$other_users_appended = $element;
});
@@ -573,7 +573,7 @@ test("insert_alice_then_fred", ({override, override_rewire, mock_template}) => {
mock_template("presence_row.hbs", true, (_data, html) => html);
let $other_users_appended;
- override(buddy_list.$other_users_container, "append", ($element) => {
+ override(buddy_list.$other_users_list, "append", ($element) => {
$other_users_appended = $element;
});
override(padded_widget, "update_padding", noop);
@@ -599,7 +599,7 @@ test("insert_fred_then_alice_then_rename, both as users matching view", ({
peer_data.set_subscribers(rome_sub.stream_id, [alice.user_id, fred.user_id]);
let $users_matching_view_appended;
- override(buddy_list.$users_matching_view_container, "append", ($element) => {
+ override(buddy_list.$users_matching_view_list, "append", ($element) => {
$users_matching_view_appended = $element;
});
override(padded_widget, "update_padding", noop);
@@ -656,7 +656,7 @@ test("insert_fred_then_alice_then_rename, both as other users", ({
peer_data.set_subscribers(rome_sub.stream_id, []);
let $other_users_appended;
- override(buddy_list.$other_users_container, "append", ($element) => {
+ override(buddy_list.$other_users_list, "append", ($element) => {
$other_users_appended = $element;
});
override(padded_widget, "update_padding", noop);
@@ -795,10 +795,10 @@ test("initialize", ({override, override_rewire, mock_template}) => {
function clear() {
$.clear_all_elements();
- buddy_list.$users_matching_view_container = $("#buddy-list-users-matching-view");
- buddy_list.$users_matching_view_container.append = noop;
- buddy_list.$other_users_container = $("#buddy-list-other-users");
- buddy_list.$other_users_container.append = noop;
+ buddy_list.$users_matching_view_list = $("#buddy-list-users-matching-view");
+ buddy_list.$users_matching_view_list.append = noop;
+ buddy_list.$other_users_list = $("#buddy-list-other-users");
+ buddy_list.$other_users_list.append = noop;
stub_buddy_list_elements();
mock_template("empty_list_widget_for_list.hbs", false, () => "<empty-list-stub>");
clear_buddy_list(buddy_list);
diff --git a/web/tests/user_search.test.js b/web/tests/user_search.test.js
index a938764f49a..057d9e253d0 100644
--- a/web/tests/user_search.test.js
+++ b/web/tests/user_search.test.js
@@ -9,10 +9,10 @@ const {realm} = require("./lib/zpage_params");
const fake_buddy_list = {
scroll_container_selector: "#whatever",
- $users_matching_view_container: {
+ $users_matching_view_list: {
attr() {},
},
- $other_users_container: {
+ $other_users_list: {
attr() {},
},
find_li() {},