Fix & improve send_file handling of offline account
- Show a transfer stuck at 0kb uploaded in the GUI instead of waiting to be online to show anything - Fix getting online not making the upload start
This commit is contained in:
parent
e5a196dcf8
commit
79fdc710c3
1
TODO.md
1
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
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user