Skip to content

Commit

Permalink
Merge pull request #4 from vector-im/tadzik/fix-max-initial-sync-for-…
Browse files Browse the repository at this point in the history
…chats

Make max_initial_member_sync work for Chats as well as Channels
  • Loading branch information
tadzik authored Oct 28, 2021
2 parents a099125 + bf8dd6d commit cc64031
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mautrix_telegram/portal/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,15 +838,16 @@ async def _get_channel_users(self, user: 'AbstractUser', entity: InputChannel, l
async def _get_users(self, user: 'AbstractUser',
entity: Union[TypeInputPeer, InputUser, TypeChat, TypeUser, InputChannel]
) -> List[TypeUser]:
limit = self.max_initial_member_sync
if self.peer_type == "chat":
chat = await user.client(GetFullChatRequest(chat_id=self.tgid))
return list(self._filter_participants(chat.users,
chat.full_chat.participants.participants))
return list(
self._filter_participants(chat.users, chat.full_chat.participants.participants)
)[:limit]
elif self.peer_type == "channel":
if not self.megagroup and not self.sync_channel_members:
return []

limit = self.max_initial_member_sync
if limit == 0:
return []

Expand Down

0 comments on commit cc64031

Please sign in to comment.