Handle leaving Matrix rooms

Fixes #28 - Leaving group chat portals leaves the Telegram chat
Fixes #29 - Leaving private chat portals makes the bridge forget that room
This commit is contained in:
Tulir Asokan
2018-01-29 23:01:03 +02:00
parent 4593e1c857
commit b8bcd84c68
4 changed files with 24 additions and 7 deletions
+3 -2
View File
@@ -210,8 +210,9 @@ class User:
elif isinstance(update, (UpdateChatAdmins, UpdateChatParticipantAdmin)):
self.update_admin(update)
elif isinstance(update, UpdateChatParticipants):
portal = po.Portal.get_by_tgid(update.participants.chat_id, peer_type="chat")
portal.update_telegram_participants(update.participants.participants)
portal = po.Portal.get_by_tgid(update.participants.chat_id, peer_type=None)
if portal and portal.mxid:
portal.update_telegram_participants(update.participants.participants)
else:
self.log.debug("Unhandled update: %s", update)