mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
buddy_list: Remove deactivated users from right sidebar.
Filter out inactive people from the buddy list in the right sidebar.
This commit is contained in:
@@ -326,6 +326,11 @@ function filter_user_ids(user_filter_text: string, user_ids: number[]): number[]
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!people.is_person_active(user_id)) {
|
||||
// Deactivated users are hidden from the right sidebar entirely.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (muted_users.is_user_muted(user_id)) {
|
||||
// Muted users are hidden from the right sidebar entirely.
|
||||
return false;
|
||||
|
||||
@@ -52,7 +52,7 @@ function get_total_human_subscriber_count(
|
||||
|
||||
let human_user_count = 0;
|
||||
for (const pm_id of all_recipient_user_ids_set) {
|
||||
if (!people.is_valid_bot_user(pm_id)) {
|
||||
if (!people.is_valid_bot_user(pm_id) && people.is_person_active(pm_id)) {
|
||||
human_user_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ export function get_subscriber_count(stream_id: number, include_bots = true): nu
|
||||
|
||||
let count = 0;
|
||||
for (const user_id of get_user_set(stream_id).keys()) {
|
||||
if (!people.is_valid_bot_user(user_id)) {
|
||||
if (!people.is_valid_bot_user(user_id) && people.is_person_active(user_id)) {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,15 +218,26 @@ test("title_data", () => {
|
||||
assert.deepEqual(buddy_data.get_title_data(old_user.user_id, is_group), expected_data);
|
||||
});
|
||||
|
||||
test("simple search", () => {
|
||||
test("filters deactivated users", () => {
|
||||
add_canned_users();
|
||||
|
||||
set_presence(selma.user_id, "active");
|
||||
set_presence(me.user_id, "active");
|
||||
|
||||
const user_ids = buddy_data.get_filtered_and_sorted_user_ids("selm");
|
||||
let user_ids = buddy_data.get_filtered_and_sorted_user_ids("selm");
|
||||
|
||||
assert.deepEqual(user_ids, [selma.user_id]);
|
||||
assert.ok(buddy_data.matches_filter("selm", selma.user_id));
|
||||
|
||||
// Deactivated users are excluded.
|
||||
people.deactivate(selma);
|
||||
|
||||
user_ids = buddy_data.get_filtered_and_sorted_user_ids("selm");
|
||||
assert.deepEqual(user_ids, []);
|
||||
|
||||
user_ids = buddy_data.get_filtered_and_sorted_user_ids();
|
||||
assert.equal(user_ids.includes(selma.user_id), false);
|
||||
assert.ok(!buddy_data.matches_filter("selm", selma.user_id));
|
||||
});
|
||||
|
||||
test("muted users excluded from search", () => {
|
||||
|
||||
Reference in New Issue
Block a user