Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
people: Fix is_active_user_for_popover for inaccessible users.
Sahil Batra31175752a0b8
diff --git a/web/src/people.ts b/web/src/people.tsindex 9de0a0b94e8..bdacc9d5337 100644--- a/web/src/people.ts+++ b/web/src/people.ts@@ -995,6 +995,14 @@ export function is_active_user_for_popover(user_id: number): boolean {// deactivated users at page-load time. For now just warn.if (!people_by_user_id_dict.has(user_id)) {blueslip.warn("Unexpectedly invalid user_id in user popover query", {user_id});+ // We return true for inaccessible users. We can assume+ // this code will not be called for invalid IDs.+ return true;+ }++ const user = people_by_user_id_dict.get(user_id)!;+ if (user.is_inaccessible_user) {+ return true;}return false;diff --git a/web/tests/people.test.cjs b/web/tests/people.test.cjsindex 69a5e2b1f58..0d85ca6ebd5 100644--- a/web/tests/people.test.cjs+++ b/web/tests/people.test.cjs@@ -416,9 +416,13 @@ test_people("basics", ({override}) => {// The bot doesn't add to our human count.assert.equal(people.get_active_human_count(), 1);- // Invalid user ID returns false and warns.+ // Invalid user ID returns true and warns.blueslip.expect("warn", "Unexpectedly invalid user_id in user popover query");- assert.equal(people.is_active_user_for_popover(123412), false);+ assert.equal(people.is_active_user_for_popover(123412), true);++ unknown_user.is_inaccessible_user = true;+ assert.equal(people.is_active_user_for_popover(unknown_user.user_id), true);+ unknown_user.is_inaccessible_user = false;// We can still get their info for non-realm needs.person = people.get_by_email(email);