people: Extract function to check if user is a narrow participant.

To be commonly used in ConversationParticipants.
This commit is contained in:
Aman Agrawal
2024-12-13 11:50:46 +05:30
committed by Tim Abbott
parent 71b41af95a
commit 63584f3076
2 changed files with 5 additions and 4 deletions

View File

@@ -460,10 +460,7 @@ export function get_conversation_participants(): Set<number> {
return participant_ids_set;
}
for (const message of message_lists.current.all_messages()) {
if (
!people.is_valid_bot_user(message.sender_id) &&
people.is_person_active(message.sender_id)
) {
if (people.is_displayable_conversation_participant(message.sender_id)) {
participant_ids_set.add(message.sender_id);
}
}

View File

@@ -1762,6 +1762,10 @@ export function sort_but_pin_current_user_on_top(users: User[]): void {
}
}
export function is_displayable_conversation_participant(user_id: number): boolean {
return !is_valid_bot_user(user_id) && is_person_active(user_id);
}
export function initialize(my_user_id: number, params: StateData["people"]): void {
for (const person of params.realm_users) {
add_active_user(person);