Skip to content

Commit 2a2ffde

Browse files
authored
Merge pull request #710 from GetStream/prepare-for-default-member-limit-change
fix: remove static member limit assumption
2 parents 7b9651b + 3fed688 commit 2a2ffde

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

projects/stream-chat-angular/src/lib/channel.service.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,6 +1860,7 @@ describe('ChannelService', () => {
18601860
john: { user: { id: 'john' } },
18611861
[user.id]: { user },
18621862
} as any as Record<string, ChannelMemberResponse>;
1863+
channel.data = { member_count: 3, own_capabilities: [] };
18631864
service.setAsActiveChannel(channel);
18641865
const result = await service.autocompleteMembers('ja');
18651866
const expectedResult = [

projects/stream-chat-angular/src/lib/channel.service.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ export class ChannelService {
10841084
}
10851085

10861086
/**
1087-
* 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.
1087+
* 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.
10881088
* @param searchTerm Text to search for in the names of members
10891089
* @returns The list of members matching the search filter
10901090
*/
@@ -1093,7 +1093,10 @@ export class ChannelService {
10931093
if (!activeChannel) {
10941094
return [];
10951095
}
1096-
if (Object.keys(activeChannel.state.members).length < 100) {
1096+
if (
1097+
Object.keys(activeChannel.state.members).length ===
1098+
(activeChannel.data?.member_count ?? 0)
1099+
) {
10971100
return Object.values(activeChannel.state.members).filter(
10981101
(m) => m.user?.id !== this.chatClientService.chatClient.userID!
10991102
);

0 commit comments

Comments
 (0)