Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix invalid validation for room aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Dariusz Niemczyk committed Nov 10, 2021
1 parent 647ce83 commit 8879271
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/components/views/room_settings/AliasSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,20 +206,25 @@ export default class AliasSettings extends React.Component<IProps, IState> {
eventContent["alt_aliases"] = altAliases;
}

this.context.sendStateEvent(this.props.roomId, "m.room.canonical_alias",
this.context.mxClient.sendStateEvent(this.props.roomId, "m.room.canonical_alias",
eventContent, "").catch((err) => {
logger.error(err);
Modal.createTrackedDialog('Error updating alternative addresses', '', ErrorDialog, {
title: _t("Error updating main address"),
description: _t(
"There was an error updating the room's alternative addresses. " +
this.context.sendStateEvent(this.props.roomId, "m.room.canonical_alias", eventContent, "")
.then(() => {
this.setState({
altAliases,
});
})
.catch((err) => {
// TODO: Add error handling based upon server validation
logger.error(err);
Modal.createTrackedDialog('Error updating alternative addresses', '', ErrorDialog, {
title: _t("Error updating main address"),
description: _t(
"There was an error updating the room's alternative addresses. " +
"It may not be allowed by the server or a temporary failure occurred.",
),
),
});
}).finally(() => {
this.setState({ updatingCanonicalAlias: false });
});
}).finally(() => {
this.setState({ updatingCanonicalAlias: false });
});
}

private onNewAliasChanged = (value: string) => {
Expand Down

0 comments on commit 8879271

Please sign in to comment.