From 2db0a9c005c739a6dbded4bc298912a36f778c0c Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 29 Jan 2019 16:29:30 +0100 Subject: [PATCH] show Guest instead of random username when in guest mode --- src/components/structures/TopLeftMenuButton.js | 10 +++++++++- src/i18n/strings/en_EN.json | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/structures/TopLeftMenuButton.js b/src/components/structures/TopLeftMenuButton.js index 592b64634f..601fb2e654 100644 --- a/src/components/structures/TopLeftMenuButton.js +++ b/src/components/structures/TopLeftMenuButton.js @@ -22,6 +22,7 @@ import AccessibleButton from '../views/elements/AccessibleButton'; import BaseAvatar from '../views/avatars/BaseAvatar'; import MatrixClientPeg from '../../MatrixClientPeg'; import Avatar from '../../Avatar'; +import { _t } from '../../languageHandler'; const AVATAR_SIZE = 28; @@ -70,7 +71,14 @@ export default class TopLeftMenuButton extends React.Component { render() { const fallbackUserId = MatrixClientPeg.get().getUserId(); 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; if (!this.props.collapsed) { nameElement =
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 4d67c33dad..1d9913f2fd 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -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.", "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 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" }