Fix new added account's order
This commit is contained in:
parent
241c16932f
commit
ccd2308427
|
@ -69,6 +69,8 @@ and this project adheres to
|
|||
- Make sure the account shown in the left pane is immediatly updated
|
||||
after changing display name or avatar in the accounty settings
|
||||
|
||||
- When signing in a new account, correctly position it after the other
|
||||
existing ones without needing a restart
|
||||
|
||||
## 0.5.0
|
||||
|
||||
|
|
1
TODO.md
1
TODO.md
|
@ -3,7 +3,6 @@
|
|||
- fix cursor over field
|
||||
- update room highlight when creating new room
|
||||
- keyerror when forgetting room while loading members
|
||||
- account order, and verify not adding to config fiel works
|
||||
|
||||
## Refactoring
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ class Backend:
|
|||
password: str,
|
||||
device_id: Optional[str] = None,
|
||||
homeserver: str = "https://matrix.org",
|
||||
order: int = -1,
|
||||
order: Optional[int] = None,
|
||||
) -> str:
|
||||
"""Create and register a `MatrixClient`, login and return a user ID."""
|
||||
|
||||
|
@ -131,6 +131,14 @@ class Backend:
|
|||
await client.close()
|
||||
raise
|
||||
|
||||
if order is None and not self.models["accounts"]:
|
||||
order = 0
|
||||
elif order is None:
|
||||
order = max(
|
||||
account.order
|
||||
for i, account in enumerate(self.models["accounts"].values())
|
||||
) + 1
|
||||
|
||||
self.clients[client.user_id] = client
|
||||
self.models["accounts"][client.user_id] = Account(client.user_id,order)
|
||||
return client.user_id
|
||||
|
|
Loading…
Reference in New Issue
Block a user