Only leave group chat portals with default puppet. Fixes #418

This commit is contained in:
Tulir Asokan
2020-02-08 12:50:17 +02:00
parent 62efc39eed
commit da72c51644
+5 -1
View File
@@ -25,7 +25,7 @@ from telethon.tl.types import (UserProfilePhoto, User, UpdateUserName, PeerUser,
from mautrix.appservice import AppService, IntentAPI
from mautrix.errors import MatrixRequestError
from mautrix.bridge import CustomPuppetMixin
from mautrix.types import UserID, SyncToken
from mautrix.types import UserID, SyncToken, RoomID
from mautrix.util.simple_template import SimpleTemplate
from .types import TelegramID
@@ -320,6 +320,10 @@ class Puppet(CustomPuppetMixin):
return True
return False
def default_puppet_should_leave_room(self, room_id: RoomID) -> bool:
portal: p.Portal = p.Portal.get_by_mxid(room_id)
return portal and not portal.backfilling and portal.peer_type != "user"
# endregion
# region Getters