Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1860,6 +1860,7 @@ describe('ChannelService', () => {
john: { user: { id: 'john' } },
[user.id]: { user },
} as any as Record<string, ChannelMemberResponse>;
channel.data = { member_count: 3, own_capabilities: [] };
service.setAsActiveChannel(channel);
const result = await service.autocompleteMembers('ja');
const expectedResult = [
Expand Down
7 changes: 5 additions & 2 deletions projects/stream-chat-angular/src/lib/channel.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ export class ChannelService {
}

/**
* Returns the autocomplete options for current channel members. If the channel has less than 100 members, it returns the channel members, otherwise sends a [search request](/chat/docs/javascript/query_members/#pagination-and-ordering) with the given search term.
* Returns the autocomplete options for current channel members. If member_count is equal to the number of members in the channel, it returns the channel members, otherwise sends a [search request](/chat/docs/javascript/query_members/#pagination-and-ordering) with the given search term.
* @param searchTerm Text to search for in the names of members
* @returns The list of members matching the search filter
*/
Expand All @@ -1093,7 +1093,10 @@ export class ChannelService {
if (!activeChannel) {
return [];
}
if (Object.keys(activeChannel.state.members).length < 100) {
if (
Object.keys(activeChannel.state.members).length ===
(activeChannel.data?.member_count ?? 0)
) {
return Object.values(activeChannel.state.members).filter(
(m) => m.user?.id !== this.chatClientService.chatClient.userID!
);
Expand Down