people: Do not return undefined for is_cross_realm_email.

It would be semantically more straightfoward to return false when the
check does not succeed.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
Zixuan James Li 2023-03-10 17:22:28 -05:00 committed by Tim Abbott
parent 111f2f5e9d
commit cd97c497bc
2 changed files with 2 additions and 2 deletions

View File

@ -943,7 +943,7 @@ export function get_non_active_realm_users() {
export function is_cross_realm_email(email) {
const person = get_by_email(email);
if (!person) {
return undefined;
return false;
}
return cross_realm_dict.has(person.user_id);
}

View File

@ -352,7 +352,7 @@ test_people("basics", () => {
assert.equal(person.full_name, "Me Myself");
// Test undefined people
assert.equal(people.is_cross_realm_email("unknown@example.com"), undefined);
assert.equal(people.is_cross_realm_email("unknown@example.com"), false);
// Test is_my_user_id function
assert.equal(people.is_my_user_id(me.user_id), true);