mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-01 11:03:18 +03:00
Display profile errors better
This commit is contained in:
parent
e88b52fa8f
commit
6e84b6e996
1 changed files with 12 additions and 3 deletions
|
@ -38,6 +38,7 @@ export default class ChatCreateOrReuseDialog extends React.Component {
|
||||||
displayName: null,
|
displayName: null,
|
||||||
avatarUrl: null,
|
avatarUrl: null,
|
||||||
},
|
},
|
||||||
|
profileError: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ export default class ChatCreateOrReuseDialog extends React.Component {
|
||||||
this.setState({
|
this.setState({
|
||||||
busyProfile: true,
|
busyProfile: true,
|
||||||
});
|
});
|
||||||
MatrixClientPeg.get().getProfileInfo(this.props.userId).then((resp) => {
|
MatrixClientPeg.get().getProfileInfo(this.props.userId).done((resp) => {
|
||||||
const profile = {
|
const profile = {
|
||||||
displayName: resp.displayname,
|
displayName: resp.displayname,
|
||||||
avatarUrl: null,
|
avatarUrl: null,
|
||||||
|
@ -90,13 +91,17 @@ export default class ChatCreateOrReuseDialog extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
|
busyProfile: false,
|
||||||
profile: profile,
|
profile: profile,
|
||||||
});
|
});
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
console.error('Unable to get profile for user', this.props.userId, err);
|
console.error(
|
||||||
}).finally(() => {
|
'Unable to get profile for user ' + this.props.userId + ':',
|
||||||
|
err,
|
||||||
|
);
|
||||||
this.setState({
|
this.setState({
|
||||||
busyProfile: false,
|
busyProfile: false,
|
||||||
|
profileError: err,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -141,6 +146,10 @@ export default class ChatCreateOrReuseDialog extends React.Component {
|
||||||
let profile = null;
|
let profile = null;
|
||||||
if (this.state.busyProfile) {
|
if (this.state.busyProfile) {
|
||||||
profile = <Spinner />;
|
profile = <Spinner />;
|
||||||
|
} else if (this.state.profileError) {
|
||||||
|
profile = <div className="error">
|
||||||
|
Unable to load profile information for { this.props.userId }
|
||||||
|
</div>;
|
||||||
} else {
|
} else {
|
||||||
profile = <div className="mx_ChatCreateOrReuseDialog_profile">
|
profile = <div className="mx_ChatCreateOrReuseDialog_profile">
|
||||||
<BaseAvatar
|
<BaseAvatar
|
||||||
|
|
Loading…
Reference in a new issue