From 23bcbc50e31c29b9dfff0529a9a45b3d290592b8 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 20 Feb 2019 12:52:29 +0100 Subject: [PATCH] show dialog when failing to load profile info --- src/components/structures/UserView.js | 9 +++++++-- src/i18n/strings/en_EN.json | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/structures/UserView.js b/src/components/structures/UserView.js index 4321aaccb9..2fe9c0937c 100644 --- a/src/components/structures/UserView.js +++ b/src/components/structures/UserView.js @@ -18,7 +18,8 @@ import React from "react"; import Matrix from "matrix-js-sdk"; import MatrixClientPeg from "../../MatrixClientPeg"; import sdk from "../../index"; - +import Modal from '../../Modal'; +import { _t } from '../../languageHandler'; export default class UserView extends React.Component { static get propTypes() { @@ -51,7 +52,11 @@ export default class UserView extends React.Component { try { profileInfo = await cli.getProfileInfo(this.props.userId); } catch (err) { - // show dialog or error or something + const ErrorDialog = sdk.getComponent('dialogs.ErrorDialog'); + Modal.createTrackedDialog(_t('Could not load user profile'), '', ErrorDialog, { + title: _t('Could not load user profile'), + description: ((err && err.message) ? err.message : _t("Operation failed")), + }); this.setState({loading: false}); return; } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 5c813b1ae6..d5fb42160b 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1402,6 +1402,7 @@ "Uploading %(filename)s and %(count)s others|other": "Uploading %(filename)s and %(count)s others", "Uploading %(filename)s and %(count)s others|zero": "Uploading %(filename)s", "Uploading %(filename)s and %(count)s others|one": "Uploading %(filename)s and %(count)s other", + "Could not load user profile": "Could not load user profile", "Failed to send email": "Failed to send email", "The email address linked to your account must be entered.": "The email address linked to your account must be entered.", "A new password must be entered.": "A new password must be entered.",