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.

eslint: Fix unicorn/prefer-set-methods.

Anders Kaseorg7f0b6bdc372a
diff --git a/web/src/buddy_list.ts b/web/src/buddy_list.ts
index b804309ae10..1316e65c882 100644
--- a/web/src/buddy_list.ts
+++ b/web/src/buddy_list.ts
@@ -1162,17 +1162,11 @@ export class BuddyList extends BuddyListConf {
const all_participant_ids = this.render_data.get_all_participant_ids();
const existing_participant_ids = new Set(this.participants_section.user_ids);
- const users_to_remove = this.participants_section.user_ids.filter(
- (user_id) => !all_participant_ids.has(user_id),
- );
- const users_to_add = [...all_participant_ids].filter(
- (user_id) => !existing_participant_ids.has(user_id),
- );
// We are just moving the users around since we still want to show the
// user in buddy list regardless of if they are a participant, so we
- // call `insert_or_move` on both `users_to_remove` and `users_to_add`.
- this.insert_or_move([...users_to_remove, ...users_to_add]);
+ // call `insert_or_move` on both removed and added users.
+ this.insert_or_move([...existing_participant_ids.symmetricDifference(all_participant_ids)]);
}
fill_screen_with_content(): void {