Check that relay users are connected

This commit is contained in:
Andrew Ferrazzutti 2022-04-10 02:21:00 -04:00
parent a7a3ab694e
commit cf83e86e78

View File

@ -47,7 +47,12 @@ class MatrixHandler(BaseMatrixHandler):
@staticmethod @staticmethod
async def allow_bridging_message(user: u.User, portal: po.Portal) -> bool: async def allow_bridging_message(user: u.User, portal: po.Portal) -> bool:
return user.is_connected or (user.relay_whitelisted and portal.has_relay) if user.is_connected:
return True
if user.relay_whitelisted and portal.has_relay:
relay_user = await portal.get_relay_user()
return relay_user and relay_user.is_connected
return False
async def send_welcome_message(self, room_id: RoomID, inviter: u.User) -> None: async def send_welcome_message(self, room_id: RoomID, inviter: u.User) -> None:
await super().send_welcome_message(room_id, inviter) await super().send_welcome_message(room_id, inviter)