2021-03-28 17:57:53 +02:00
|
|
|
/*
|
|
|
|
We keep a set of user_ids for all people
|
|
|
|
who have sent stream messages or who have
|
|
|
|
been on PMs sent by the user.
|
|
|
|
|
|
|
|
We will use this in search to prevent really
|
|
|
|
large result sets for realms that have lots
|
|
|
|
of users who haven't sent messages recently.
|
|
|
|
|
|
|
|
We'll likely eventually want to replace this with
|
|
|
|
accessing some combination of data from recent_senders
|
|
|
|
and pm_conversations for better accuracy.
|
|
|
|
*/
|
2021-04-09 19:16:32 +02:00
|
|
|
const user_set = new Set<number>();
|
2021-03-28 17:57:53 +02:00
|
|
|
|
2021-04-09 19:16:32 +02:00
|
|
|
export function clear_for_testing(): void {
|
2021-04-03 18:23:49 +02:00
|
|
|
user_set.clear();
|
|
|
|
}
|
|
|
|
|
2021-04-09 19:16:32 +02:00
|
|
|
export function user_ids(): number[] {
|
2021-03-28 17:57:53 +02:00
|
|
|
return Array.from(user_set);
|
|
|
|
}
|
|
|
|
|
2021-04-09 19:16:32 +02:00
|
|
|
export function add_user_id(user_id: number): void {
|
2021-03-28 17:57:53 +02:00
|
|
|
user_set.add(user_id);
|
|
|
|
}
|