From d3cbb51ecb556b690d7440d1d9bc890c5a0638a7 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 2 Oct 2020 15:39:34 +0100 Subject: [PATCH 1/2] Use Own Profile Store for the Profile Settings Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../views/settings/ProfileSettings.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/components/views/settings/ProfileSettings.js b/src/components/views/settings/ProfileSettings.js index 651aa9f48d..bf187ac9c6 100644 --- a/src/components/views/settings/ProfileSettings.js +++ b/src/components/views/settings/ProfileSettings.js @@ -18,30 +18,21 @@ import React, {createRef} from 'react'; import {_t} from "../../../languageHandler"; import {MatrixClientPeg} from "../../../MatrixClientPeg"; import Field from "../elements/Field"; -import {User} from "matrix-js-sdk"; import { getHostingLink } from '../../../utils/HostingLink'; import * as sdk from "../../../index"; +import {OwnProfileStore} from "../../../stores/OwnProfileStore"; export default class ProfileSettings extends React.Component { constructor() { super(); const client = MatrixClientPeg.get(); - let user = client.getUser(client.getUserId()); - if (!user) { - // XXX: We shouldn't have to do this. - // There seems to be a condition where the User object won't exist until a room - // exists on the account. To work around this, we'll just create a temporary User - // and use that. - console.warn("User object not found - creating one for ProfileSettings"); - user = new User(client.getUserId()); - } - let avatarUrl = user.avatarUrl; + let avatarUrl = OwnProfileStore.instance.avatarMxc; if (avatarUrl) avatarUrl = client.mxcUrlToHttp(avatarUrl, 96, 96, 'crop', false); this.state = { - userId: user.userId, - originalDisplayName: user.rawDisplayName, - displayName: user.rawDisplayName, + userId: client.getUserId(), + originalDisplayName: OwnProfileStore.instance.displayName, + displayName: OwnProfileStore.instance.displayName, originalAvatarUrl: avatarUrl, avatarUrl: avatarUrl, avatarFile: null, From cf37f0abf2422915eb3c5c793286f74b2d55295e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 5 Oct 2020 12:54:01 +0100 Subject: [PATCH 2/2] Fix the AvatarSetting avatar getting crushed by the flexbox Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- res/css/views/settings/_AvatarSetting.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/res/css/views/settings/_AvatarSetting.scss b/res/css/views/settings/_AvatarSetting.scss index 52a0ee95d7..4a1f57a00e 100644 --- a/res/css/views/settings/_AvatarSetting.scss +++ b/res/css/views/settings/_AvatarSetting.scss @@ -16,6 +16,7 @@ limitations under the License. .mx_AvatarSetting_avatar { width: 90px; + min-width: 90px; // so it doesn't get crushed by the flexbox in languages with longer words height: 90px; margin-top: 8px; position: relative;