Fix infinite account spinner when logging in twice
This commit is contained in:
parent
bd01d9edd0
commit
e0e92152d0
1
TODO.md
1
TODO.md
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
- refresh server list button
|
- refresh server list button
|
||||||
- server list sorting method / explain what the % number is (stability)
|
- server list sorting method / explain what the % number is (stability)
|
||||||
- login with account already added → infinite spinner in room list
|
|
||||||
|
|
||||||
- global presence control
|
- global presence control
|
||||||
|
|
||||||
|
|
|
@ -247,7 +247,6 @@ class Backend:
|
||||||
await client.close()
|
await client.close()
|
||||||
raise
|
raise
|
||||||
|
|
||||||
# Check if the user is already present on mirage
|
|
||||||
if client.user_id in self.clients:
|
if client.user_id in self.clients:
|
||||||
await client.logout()
|
await client.logout()
|
||||||
return client.user_id
|
return client.user_id
|
||||||
|
|
|
@ -281,7 +281,7 @@ class MatrixClient(nio.AsyncClient):
|
||||||
self.user_id, Account(self.user_id, order),
|
self.user_id, Account(self.user_id, order),
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: be abke to set presence before logging in
|
# TODO: be able to set presence before logging in
|
||||||
item.set_fields(presence=Presence.State.online, connecting=True)
|
item.set_fields(presence=Presence.State.online, connecting=True)
|
||||||
self._presence = "online"
|
self._presence = "online"
|
||||||
self.start_task = asyncio.ensure_future(self._start())
|
self.start_task = asyncio.ensure_future(self._start())
|
||||||
|
|
|
@ -113,13 +113,13 @@ class NioCallbacks:
|
||||||
self.client.all_rooms[room_id], left=True,
|
self.client.all_rooms[room_id], left=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
account = self.models["accounts"][self.user_id]
|
||||||
|
account.connecting = False
|
||||||
|
|
||||||
if not self.client.first_sync_done.is_set():
|
if not self.client.first_sync_done.is_set():
|
||||||
self.client.first_sync_done.set()
|
self.client.first_sync_done.set()
|
||||||
self.client.first_sync_date = datetime.now()
|
self.client.first_sync_date = datetime.now()
|
||||||
|
|
||||||
account = self.models["accounts"][self.user_id]
|
|
||||||
account.connecting = False
|
|
||||||
|
|
||||||
|
|
||||||
async def onKeysQueryResponse(self, resp: nio.KeysQueryResponse) -> None:
|
async def onKeysQueryResponse(self, resp: nio.KeysQueryResponse) -> None:
|
||||||
refresh_rooms = {}
|
refresh_rooms = {}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user