mirror of https://github.com/zulip/zulip.git
people: Revert to using `ignore_missing` parameter.
We revert to use `ignore_missing` parameter for `maybe_get_user_by_id` function to avoid sending unnecessary `blueslip.error()` calls to sentry.
This commit is contained in:
parent
bfd52ccd68
commit
2893685890
|
@ -121,8 +121,8 @@ export function get_by_user_id(user_id: number): User {
|
|||
}
|
||||
|
||||
// This is type unsafe version of get_by_user_id for the callers that expects undefined values.
|
||||
export function maybe_get_user_by_id(user_id: number): User | undefined {
|
||||
if (!people_by_user_id_dict.has(user_id)) {
|
||||
export function maybe_get_user_by_id(user_id: number, ignore_missing = false): User | undefined {
|
||||
if (!people_by_user_id_dict.has(user_id) && !ignore_missing) {
|
||||
blueslip.error("Unknown user_id in maybe_get_user_by_id", {user_id});
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ export function set_info(presences, server_timestamp) {
|
|||
// reload_state.is_in_progress, because races where presence
|
||||
// returns data on users not yet received via the server_events
|
||||
// system are common in both situations.
|
||||
const person = people.maybe_get_user_by_id(user_id);
|
||||
const person = people.maybe_get_user_by_id(user_id, true);
|
||||
if (person === undefined) {
|
||||
if (!(watchdog.suspects_user_is_offline() || reload_state.is_in_progress())) {
|
||||
// If we're online, and we get a user who we don't
|
||||
|
|
|
@ -107,7 +107,7 @@ export const update_elements = ($content) => {
|
|||
// mention text to show the user's current name,
|
||||
// assuming that you're not searching for text
|
||||
// inside the highlight.
|
||||
const person = people.maybe_get_user_by_id(user_id);
|
||||
const person = people.maybe_get_user_by_id(user_id, true);
|
||||
if (person !== undefined) {
|
||||
// Note that person might be undefined in some
|
||||
// unpleasant corner cases involving data import.
|
||||
|
|
|
@ -95,7 +95,6 @@ test("unknown user", ({override}) => {
|
|||
const presences = {};
|
||||
presences[unknown_user_id.toString()] = "does-not-matter";
|
||||
|
||||
blueslip.expect("error", "Unknown user_id in maybe_get_user_by_id", 3);
|
||||
blueslip.expect("error", "Unknown user ID in presence data");
|
||||
presence.set_info(presences, now);
|
||||
|
||||
|
|
Loading…
Reference in New Issue