@@ -18,30 +18,21 @@ import React, {createRef} from 'react';
18
18
import { _t } from "../../../languageHandler" ;
19
19
import { MatrixClientPeg } from "../../../MatrixClientPeg" ;
20
20
import Field from "../elements/Field" ;
21
- import { User } from "matrix-js-sdk" ;
22
21
import { getHostingLink } from '../../../utils/HostingLink' ;
23
22
import * as sdk from "../../../index" ;
23
+ import { OwnProfileStore } from "../../../stores/OwnProfileStore" ;
24
24
25
25
export default class ProfileSettings extends React . Component {
26
26
constructor ( ) {
27
27
super ( ) ;
28
28
29
29
const client = MatrixClientPeg . get ( ) ;
30
- let user = client . getUser ( client . getUserId ( ) ) ;
31
- if ( ! user ) {
32
- // XXX: We shouldn't have to do this.
33
- // There seems to be a condition where the User object won't exist until a room
34
- // exists on the account. To work around this, we'll just create a temporary User
35
- // and use that.
36
- console . warn ( "User object not found - creating one for ProfileSettings" ) ;
37
- user = new User ( client . getUserId ( ) ) ;
38
- }
39
- let avatarUrl = user . avatarUrl ;
30
+ let avatarUrl = OwnProfileStore . instance . avatarMxc ;
40
31
if ( avatarUrl ) avatarUrl = client . mxcUrlToHttp ( avatarUrl , 96 , 96 , 'crop' , false ) ;
41
32
this . state = {
42
- userId : user . userId ,
43
- originalDisplayName : user . rawDisplayName ,
44
- displayName : user . rawDisplayName ,
33
+ userId : client . getUserId ( ) ,
34
+ originalDisplayName : OwnProfileStore . instance . displayName ,
35
+ displayName : OwnProfileStore . instance . displayName ,
45
36
originalAvatarUrl : avatarUrl ,
46
37
avatarUrl : avatarUrl ,
47
38
avatarFile : null ,
0 commit comments