people: Remove string type for user_id.

Further discussion here:
https://github.com/zulip/zulip/pull/28418#discussion_r1442220867
This commit is contained in:
evykassirer 2024-01-04 22:59:15 -08:00 committed by Tim Abbott
parent e4ba07dcf2
commit 4c5f115a6e
3 changed files with 1 additions and 17 deletions

View File

@ -1717,16 +1717,7 @@ export function get_custom_fields_by_type(
return filteredProfileData;
}
export function is_my_user_id(user_id: number | string): boolean {
if (!user_id) {
return false;
}
if (typeof user_id !== "number") {
blueslip.error("user_id is a string in my_user_id", {user_id});
user_id = Number.parseInt(user_id, 10);
}
export function is_my_user_id(user_id: number): boolean {
return user_id === my_user_id;
}

View File

@ -390,7 +390,6 @@ test_people("basics", ({override}) => {
// Test is_my_user_id function
assert.equal(people.is_my_user_id(me.user_id), true);
assert.equal(people.is_my_user_id(isaac.user_id), false);
assert.equal(people.is_my_user_id(undefined), false);
// Reactivating issac
people.add_active_user(isaac);

View File

@ -39,12 +39,6 @@ run_test("report_late_add", ({override}) => {
people.report_late_add(55, "foo@example.com");
});
run_test("is_my_user_id", () => {
blueslip.expect("error", "user_id is a string in my_user_id", 2);
assert.equal(people.is_my_user_id("999"), false);
assert.equal(people.is_my_user_id(me.user_id.toString()), true);
});
run_test("blueslip", () => {
const unknown_email = "alicebobfred@example.com";