mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
show Guest instead of random username when in guest mode
This commit is contained in:
parent
495f264ad5
commit
2db0a9c005
2 changed files with 11 additions and 2 deletions
|
@ -22,6 +22,7 @@ import AccessibleButton from '../views/elements/AccessibleButton';
|
||||||
import BaseAvatar from '../views/avatars/BaseAvatar';
|
import BaseAvatar from '../views/avatars/BaseAvatar';
|
||||||
import MatrixClientPeg from '../../MatrixClientPeg';
|
import MatrixClientPeg from '../../MatrixClientPeg';
|
||||||
import Avatar from '../../Avatar';
|
import Avatar from '../../Avatar';
|
||||||
|
import { _t } from '../../languageHandler';
|
||||||
|
|
||||||
const AVATAR_SIZE = 28;
|
const AVATAR_SIZE = 28;
|
||||||
|
|
||||||
|
@ -70,7 +71,14 @@ export default class TopLeftMenuButton extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const fallbackUserId = MatrixClientPeg.get().getUserId();
|
const fallbackUserId = MatrixClientPeg.get().getUserId();
|
||||||
const profileInfo = this.state.profileInfo;
|
const profileInfo = this.state.profileInfo;
|
||||||
const name = profileInfo ? profileInfo.name : fallbackUserId;
|
let name;
|
||||||
|
if (MatrixClientPeg.get().isGuest()) {
|
||||||
|
name = _t("Guest");
|
||||||
|
} else if (profileInfo) {
|
||||||
|
name = profileInfo.name;
|
||||||
|
} else {
|
||||||
|
name = fallbackUserId;
|
||||||
|
}
|
||||||
let nameElement;
|
let nameElement;
|
||||||
if (!this.props.collapsed) {
|
if (!this.props.collapsed) {
|
||||||
nameElement = <div className="mx_TopLeftMenuButton_name">
|
nameElement = <div className="mx_TopLeftMenuButton_name">
|
||||||
|
|
|
@ -1497,5 +1497,6 @@
|
||||||
"If you didn't remove the recovery method, an attacker may be trying to access your account. Change your account password and set a new recovery method immediately in Settings.": "If you didn't remove the recovery method, an attacker may be trying to access your account. Change your account password and set a new recovery method immediately in Settings.",
|
"If you didn't remove the recovery method, an attacker may be trying to access your account. Change your account password and set a new recovery method immediately in Settings.": "If you didn't remove the recovery method, an attacker may be trying to access your account. Change your account password and set a new recovery method immediately in Settings.",
|
||||||
"Failed to set direct chat tag": "Failed to set direct chat tag",
|
"Failed to set direct chat tag": "Failed to set direct chat tag",
|
||||||
"Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room",
|
"Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room",
|
||||||
"Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room"
|
"Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room",
|
||||||
|
"Guest": "Guest"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue