Make max_initial_member_sync work for Chats as well as Channels
This commit is contained in:
@@ -833,15 +833,16 @@ class PortalMetadata(BasePortal, ABC):
|
|||||||
async def _get_users(self, user: 'AbstractUser',
|
async def _get_users(self, user: 'AbstractUser',
|
||||||
entity: Union[TypeInputPeer, InputUser, TypeChat, TypeUser, InputChannel]
|
entity: Union[TypeInputPeer, InputUser, TypeChat, TypeUser, InputChannel]
|
||||||
) -> List[TypeUser]:
|
) -> List[TypeUser]:
|
||||||
|
limit = self.max_initial_member_sync
|
||||||
if self.peer_type == "chat":
|
if self.peer_type == "chat":
|
||||||
chat = await user.client(GetFullChatRequest(chat_id=self.tgid))
|
chat = await user.client(GetFullChatRequest(chat_id=self.tgid))
|
||||||
return list(self._filter_participants(chat.users,
|
return list(
|
||||||
chat.full_chat.participants.participants))
|
self._filter_participants(chat.users, chat.full_chat.participants.participants)
|
||||||
|
)[:limit]
|
||||||
elif self.peer_type == "channel":
|
elif self.peer_type == "channel":
|
||||||
if not self.megagroup and not self.sync_channel_members:
|
if not self.megagroup and not self.sync_channel_members:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
limit = self.max_initial_member_sync
|
|
||||||
if limit == 0:
|
if limit == 0:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user