mirror of https://github.com/vector-im/riot-web
Clear displayname / vatar if they're unset
parent
cd138bf87e
commit
4a734ef70b
|
@ -124,8 +124,16 @@ export class OwnProfileStore extends AsyncStoreWithClient<IState> {
|
||||||
// We specifically do not use the User object we stored for profile info as it
|
// We specifically do not use the User object we stored for profile info as it
|
||||||
// could easily be wrong (such as per-room instead of global profile).
|
// could easily be wrong (such as per-room instead of global profile).
|
||||||
const profileInfo = await this.matrixClient.getProfileInfo(this.matrixClient.getUserId());
|
const profileInfo = await this.matrixClient.getProfileInfo(this.matrixClient.getUserId());
|
||||||
if (profileInfo.displayname) window.localStorage.setItem(KEY_DISPLAY_NAME, profileInfo.displayname);
|
if (profileInfo.displayname) {
|
||||||
if (profileInfo.avatar_url) window.localStorage.setItem(KEY_AVATAR_URL, profileInfo.avatar_url);
|
window.localStorage.setItem(KEY_DISPLAY_NAME, profileInfo.displayname);
|
||||||
|
} else {
|
||||||
|
window.localStorage.removeItem(KEY_DISPLAY_NAME);
|
||||||
|
}
|
||||||
|
if (profileInfo.avatar_url) {
|
||||||
|
window.localStorage.setItem(KEY_AVATAR_URL, profileInfo.avatar_url);
|
||||||
|
} else {
|
||||||
|
window.localStorage.removeItem(KEY_AVATAR_URL);
|
||||||
|
}
|
||||||
await this.updateState({displayName: profileInfo.displayname, avatarUrl: profileInfo.avatar_url});
|
await this.updateState({displayName: profileInfo.displayname, avatarUrl: profileInfo.avatar_url});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue