Skip to content

Commit

Permalink
Make max_initial_member_sync work for Chats as well as Channels
Browse files Browse the repository at this point in the history
  • Loading branch information
tadzik committed Oct 27, 2021
1 parent 7c5d1c2 commit 0915bb9
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 @@ -833,15 +833,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 0915bb9

Please sign in to comment.