diff --git a/TODO.md b/TODO.md index fbc9730c..023364ec 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,6 @@ # TODO +- retry if media not found - fix members not synced bug - fix local unread counters order - warn about no E2E room shared if no devices diff --git a/src/backend/matrix_client.py b/src/backend/matrix_client.py index 64bb6392..b499d905 100644 --- a/src/backend/matrix_client.py +++ b/src/backend/matrix_client.py @@ -551,10 +551,6 @@ class MatrixClient(nio.AsyncClient): async def send_file(self, room_id: str, path: Union[Path, str]) -> None: """Send a `m.file`, `m.image`, `m.audio` or `m.video` message.""" - presence = self.models["accounts"][self.user_id].presence - while presence == Presence.State.offline: - await asyncio.sleep(0.2) - item_uuid = uuid4() try: @@ -604,6 +600,12 @@ class MatrixClient(nio.AsyncClient): monitor.on_transferred = on_transferred monitor.on_speed_changed = on_speed_changed + while ( + self.models["accounts"][self.user_id].presence == + Presence.State.offline + ): + await asyncio.sleep(0.2) + try: url, mime, crypt_dict = await self.upload( lambda *_: path,