[stable12] Fix own avatar not updated when display name is changed #8130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The avatar endpoint returns the avatar image or, if the user has no avatar, the display name. In that later case the avatar is generated on the browser based on the display name. The avatar endpoint response is cached, so when the display name changes and the avatar is got again the browser could use the cached value, in which case it would use the same display name as before and the avatar would not change.
When the avatar is an image the cache is invalidated with the use of the version parameter, which is increased when the image changes. When the avatar cache was first introduced only the image avatars were cached, but it was later changed to cache all avatar responses to limit the requests made to the server. Thus, now the cache of the display name is invalidated too by increasing the version of the avatar if the display name changes and there is no explicit avatar set.
In Nextcloud 13 and current master the avatar is always generated by the server, so these changes should not be needed in those versions.
How to test this: