Support linking to hosting providers

From link in app config
This commit is contained in:
David Baker 2019-03-05 16:12:02 +00:00
parent b6351f2607
commit 57d8f6d8a2
8 changed files with 124 additions and 18 deletions

View file

@ -68,17 +68,18 @@ export default class TopLeftMenuButton extends React.Component {
}
}
render() {
const fallbackUserId = MatrixClientPeg.get().getUserId();
const profileInfo = this.state.profileInfo;
let name;
_getDisplayName() {
if (MatrixClientPeg.get().isGuest()) {
name = _t("Guest");
} else if (profileInfo) {
name = profileInfo.name;
return _t("Guest");
} else if (this.state.profileInfo) {
return this.state.profileInfo.name;
} else {
name = fallbackUserId;
return MatrixClientPeg.get().getUserId();
}
}
render() {
const name = this._getDisplayName();
let nameElement;
if (!this.props.collapsed) {
nameElement = <div className="mx_TopLeftMenuButton_name">
@ -89,9 +90,9 @@ export default class TopLeftMenuButton extends React.Component {
return (
<AccessibleButton className="mx_TopLeftMenuButton" onClick={this.onToggleMenu}>
<BaseAvatar
idName={fallbackUserId}
idName={MatrixClientPeg.get().getUserId()}
name={name}
url={profileInfo && profileInfo.avatarUrl}
url={this.state.profileInfo && this.state.profileInfo.avatarUrl}
width={AVATAR_SIZE}
height={AVATAR_SIZE}
resizeMethod="crop"
@ -114,6 +115,8 @@ export default class TopLeftMenuButton extends React.Component {
chevronFace: "none",
left: x,
top: y,
userId: MatrixClientPeg.get().getUserId(),
displayName: this._getDisplayName(),
onFinished: () => {
this.setState({ menuDisplayed: false });
},