Skip to content

Commit

Permalink
Only leave group chat portals with default puppet. Fixes #418
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Feb 8, 2020
1 parent 62efc39 commit da72c51
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mautrix_telegram/puppet.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
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
Expand Down Expand Up @@ -320,6 +320,10 @@ async def update_avatar(self, source: 'AbstractUser',
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

Expand Down

0 comments on commit da72c51

Please sign in to comment.