Fix signing out not cleaning up model data

This commit is contained in:
miruka 2020-06-29 09:22:04 -04:00
parent d0c4022fa4
commit 8a3d9affaa
2 changed files with 14 additions and 1 deletions

View File

@ -10,7 +10,8 @@
## Issues ## Issues
- Signing out leaves the account's rooms in the list - Replying to one of our own message that's currently only a local echo
results in a reply to an empty ID
- Need to unregister popups/menus when they are destroyed without being closed - Need to unregister popups/menus when they are destroyed without being closed
- Bottom focus line for an `HTextArea` inside a `ScrollView` is invisible, - Bottom focus line for an `HTextArea` inside a `ScrollView` is invisible,

View File

@ -198,8 +198,20 @@ class Backend:
"""Log a `MatrixClient` out and unregister it from our models.""" """Log a `MatrixClient` out and unregister it from our models."""
client = self.clients.pop(user_id, None) client = self.clients.pop(user_id, None)
if client: if client:
self.models["accounts"].pop(user_id, None) self.models["accounts"].pop(user_id, None)
self.models["matching_accounts"].pop(user_id, None)
self.models[user_id, "uploads"].clear()
for room_id in self.models[user_id, "rooms"]:
self.models["all_rooms"].pop(room_id, None)
self.models[user_id, room_id, "members"].clear()
self.models[user_id, room_id, "events"].clear()
self.models[user_id, room_id, "filtered_members"].clear()
self.models[user_id, "rooms"].clear()
await client.logout() await client.logout()
await self.saved_accounts.delete(user_id) await self.saved_accounts.delete(user_id)