mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 11:15:53 +03:00
Merge pull request #5272 from matrix-org/t3chguy/fix/15255
Show server errors from saving profile settings
This commit is contained in:
commit
5f615bd4c9
2 changed files with 23 additions and 14 deletions
|
@ -21,6 +21,8 @@ import Field from "../elements/Field";
|
|||
import { getHostingLink } from '../../../utils/HostingLink';
|
||||
import * as sdk from "../../../index";
|
||||
import {OwnProfileStore} from "../../../stores/OwnProfileStore";
|
||||
import Modal from "../../../Modal";
|
||||
import ErrorDialog from "../dialogs/ErrorDialog";
|
||||
|
||||
export default class ProfileSettings extends React.Component {
|
||||
constructor() {
|
||||
|
@ -75,8 +77,7 @@ export default class ProfileSettings extends React.Component {
|
|||
const client = MatrixClientPeg.get();
|
||||
const newState = {};
|
||||
|
||||
// TODO: What do we do about errors?
|
||||
|
||||
try {
|
||||
if (this.state.originalDisplayName !== this.state.displayName) {
|
||||
await client.setDisplayName(this.state.displayName);
|
||||
newState.originalDisplayName = this.state.displayName;
|
||||
|
@ -91,6 +92,12 @@ export default class ProfileSettings extends React.Component {
|
|||
} else if (this.state.originalAvatarUrl !== this.state.avatarUrl) {
|
||||
await client.setAvatarUrl(""); // use empty string as Synapse 500s on undefined
|
||||
}
|
||||
} catch (err) {
|
||||
Modal.createTrackedDialog('Failed to save profile', '', ErrorDialog, {
|
||||
title: _t("Failed to save your profile"),
|
||||
description: ((err && err.message) ? err.message : _t("The operation could not be completed")),
|
||||
});
|
||||
}
|
||||
|
||||
this.setState(newState);
|
||||
};
|
||||
|
|
|
@ -715,6 +715,8 @@
|
|||
"Off": "Off",
|
||||
"On": "On",
|
||||
"Noisy": "Noisy",
|
||||
"Failed to save your profile": "Failed to save your profile",
|
||||
"The operation could not be completed": "The operation could not be completed",
|
||||
"<a>Upgrade</a> to your own domain": "<a>Upgrade</a> to your own domain",
|
||||
"Profile": "Profile",
|
||||
"Display Name": "Display Name",
|
||||
|
|
Loading…
Reference in a new issue