Immediatly update cached profile after changing it
This commit is contained in:
parent
5bf1a90242
commit
241c16932f
@ -66,6 +66,9 @@ and this project adheres to
|
|||||||
`ssl.SSLError: [SSL: KRB5_S_INIT] application data after close notify`
|
`ssl.SSLError: [SSL: KRB5_S_INIT] application data after close notify`
|
||||||
exceptions that occur in the Flatpak releases due to a Python 3.7 bug
|
exceptions that occur in the Flatpak releases due to a Python 3.7 bug
|
||||||
|
|
||||||
|
- Make sure the account shown in the left pane is immediatly updated
|
||||||
|
after changing display name or avatar in the accounty settings
|
||||||
|
|
||||||
|
|
||||||
## 0.5.0
|
## 0.5.0
|
||||||
|
|
||||||
|
1
TODO.md
1
TODO.md
@ -4,7 +4,6 @@
|
|||||||
- update room highlight when creating new room
|
- update room highlight when creating new room
|
||||||
- keyerror when forgetting room while loading members
|
- keyerror when forgetting room while loading members
|
||||||
- account order, and verify not adding to config fiel works
|
- account order, and verify not adding to config fiel works
|
||||||
- Refetch profile after manual profile change, don't wait for a room event
|
|
||||||
|
|
||||||
## Refactoring
|
## Refactoring
|
||||||
|
|
||||||
|
@ -229,11 +229,13 @@ class Backend:
|
|||||||
|
|
||||||
# Client functions that don't need authentification
|
# Client functions that don't need authentification
|
||||||
|
|
||||||
async def get_profile(self, user_id: str) -> nio.ProfileGetResponse:
|
async def get_profile(
|
||||||
|
self, user_id: str, use_cache: bool = True,
|
||||||
|
) -> nio.ProfileGetResponse:
|
||||||
"""Cache and return the matrix profile of `user_id`."""
|
"""Cache and return the matrix profile of `user_id`."""
|
||||||
|
|
||||||
async with self.get_profile_locks[user_id]:
|
async with self.get_profile_locks[user_id]:
|
||||||
if user_id in self.profile_cache:
|
if use_cache and user_id in self.profile_cache:
|
||||||
return self.profile_cache[user_id]
|
return self.profile_cache[user_id]
|
||||||
|
|
||||||
client = await self.get_any_client()
|
client = await self.get_any_client()
|
||||||
|
@ -344,9 +344,7 @@ class MatrixClient(nio.AsyncClient):
|
|||||||
async def update_own_profile(self) -> None:
|
async def update_own_profile(self) -> None:
|
||||||
"""Fetch our profile from server and Update our model `Account`."""
|
"""Fetch our profile from server and Update our model `Account`."""
|
||||||
|
|
||||||
# XXX: verify this works when logging out quickly
|
resp = await self.backend.get_profile(self.user_id, use_cache=False)
|
||||||
|
|
||||||
resp = await self.backend.get_profile(self.user_id)
|
|
||||||
|
|
||||||
account = self.models["accounts"][self.user_id]
|
account = self.models["accounts"][self.user_id]
|
||||||
account.profile_updated = datetime.now()
|
account.profile_updated = datetime.now()
|
||||||
|
@ -13,9 +13,11 @@ HGridLayout {
|
|||||||
|
|
||||||
py.callClientCoro(
|
py.callClientCoro(
|
||||||
userId, "set_displayname", [nameField.item.text], () => {
|
userId, "set_displayname", [nameField.item.text], () => {
|
||||||
saveButton.nameChangeRunning = false
|
py.callClientCoro(userId, "update_own_profile", [], () => {
|
||||||
accountSettings.headerName =
|
saveButton.nameChangeRunning = false
|
||||||
Qt.binding(() => accountInfo.display_name)
|
accountSettings.headerName =
|
||||||
|
Qt.binding(() => accountInfo.display_name)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -32,7 +34,9 @@ HGridLayout {
|
|||||||
Qt.resolvedUrl(avatar.sourceOverride).replace(/^file:/, "")
|
Qt.resolvedUrl(avatar.sourceOverride).replace(/^file:/, "")
|
||||||
|
|
||||||
py.callClientCoro(userId, "set_avatar_from_file", [path], () => {
|
py.callClientCoro(userId, "set_avatar_from_file", [path], () => {
|
||||||
saveButton.avatarChangeRunning = false
|
py.callClientCoro(userId, "update_own_profile", [], () => {
|
||||||
|
saveButton.avatarChangeRunning = false
|
||||||
|
})
|
||||||
}, (errType, [httpCode]) => {
|
}, (errType, [httpCode]) => {
|
||||||
console.error("Avatar upload failed:", httpCode, errType)
|
console.error("Avatar upload failed:", httpCode, errType)
|
||||||
saveButton.avatarChangeRunning = false
|
saveButton.avatarChangeRunning = false
|
||||||
|
Loading…
Reference in New Issue
Block a user