Don't kick user from portal on logout if chat has relay bot. Fixes #75

This commit is contained in:
Tulir Asokan
2018-02-22 00:37:03 +02:00
parent bbab5a1376
commit 8e98ca1ce8
2 changed files with 4 additions and 1 deletions
+2 -1
View File
@@ -446,11 +446,12 @@ class Portal:
except MatrixRequestError:
return []
authenticated = []
has_bot = self.has_bot
for member in members:
if p.Puppet.get_id_from_mxid(member) or member == self.main_intent.mxid:
continue
user = await u.User.get_by_mxid(member).ensure_started()
if user.has_full_access:
if (has_bot and user.whitelisted) or user.has_full_access:
authenticated.append(user)
return authenticated
+2
View File
@@ -175,6 +175,8 @@ class User(AbstractUser):
async def log_out(self):
for _, portal in self.portals.items():
if portal.has_bot:
continue
try:
await portal.main_intent.kick(portal.mxid, self.mxid, "Logged out of Telegram.")
except MatrixRequestError: