Skip to content

Commit

Permalink
Ignore ChannelParticipantBanned in participant list. Fixes mautrix#635
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Oct 29, 2021
1 parent 3507095 commit 83d457f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion mautrix_telegram/portal/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,8 @@ async def _handle_matrix_message(self, sender: 'u.User', content: MessageEventCo
await self._handle_matrix_file(sender_id, event_id, space, client, content, reply_to,
caption_content)
else:
self.log.trace("Unhandled Matrix event: %s", content)
self.log.debug("Didn't handle Matrix event {event_id} due to unknown msgtype {content.msgtype}")
self.log.trace("Unhandled Matrix event content: %s", content)

async def handle_matrix_unpin_all(self, sender: 'u.User', pin_event_id: EventID) -> None:
await sender.client(UnpinAllMessagesRequest(peer=self.peer))
Expand Down
5 changes: 3 additions & 2 deletions mautrix_telegram/portal/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
PhotoEmpty, InputChannel, InputUser, ChatPhotoEmpty, PeerUser, Photo, TypeChat, TypeInputPeer,
TypeUser, User, InputPeerPhotoFileLocation, ChatParticipantAdmin, ChannelParticipantAdmin,
ChatParticipantCreator, ChannelParticipantCreator, UserProfilePhoto, UserProfilePhotoEmpty,
InputPeerUser)
InputPeerUser, ChannelParticipantBanned)

from mautrix.errors import MForbidden
from mautrix.types import (RoomID, UserID, RoomCreatePreset, EventType, Membership,
Expand Down Expand Up @@ -797,7 +797,8 @@ async def _update_avatar(self, user: 'AbstractUser', photo: TypeChatPhoto,
@staticmethod
def _filter_participants(users: List[TypeUser], participants: List[TypeParticipant]
) -> Iterable[TypeUser]:
participant_map = {part.user_id: part for part in participants}
participant_map = {part.user_id: part for part in participants
if not isinstance(part, ChannelParticipantBanned)}
for user in users:
try:
user.participant = participant_map[user.id]
Expand Down

0 comments on commit 83d457f

Please sign in to comment.