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

Commit 81b3512

Browse files
author
Dariusz Niemczyk
committed
Fix invalid validation for room aliases
Fixes element-hq/element-web#19609
1 parent 30aefc2 commit 81b3512

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

src/components/views/room_settings/AliasSettings.tsx

+17-12
Original file line numberDiff line numberDiff line change
@@ -206,20 +206,25 @@ export default class AliasSettings extends React.Component<IProps, IState> {
206206
eventContent["alt_aliases"] = altAliases;
207207
}
208208

209-
this.context.sendStateEvent(this.props.roomId, "m.room.canonical_alias",
210-
this.context.mxClient.sendStateEvent(this.props.roomId, "m.room.canonical_alias",
211-
eventContent, "").catch((err) => {
212-
logger.error(err);
213-
Modal.createTrackedDialog('Error updating alternative addresses', '', ErrorDialog, {
214-
title: _t("Error updating main address"),
215-
description: _t(
216-
"There was an error updating the room's alternative addresses. " +
209+
this.context.sendStateEvent(this.props.roomId, "m.room.canonical_alias", eventContent, "")
210+
.then(() => {
211+
this.setState({
212+
altAliases,
213+
});
214+
})
215+
.catch((err) => {
216+
// TODO: Add error handling based upon server validation
217+
logger.error(err);
218+
Modal.createTrackedDialog('Error updating alternative addresses', '', ErrorDialog, {
219+
title: _t("Error updating main address"),
220+
description: _t(
221+
"There was an error updating the room's alternative addresses. " +
217222
"It may not be allowed by the server or a temporary failure occurred.",
218-
),
223+
),
224+
});
225+
}).finally(() => {
226+
this.setState({ updatingCanonicalAlias: false });
219227
});
220-
}).finally(() => {
221-
this.setState({ updatingCanonicalAlias: false });
222-
});
223228
}
224229

225230
private onNewAliasChanged = (value: string) => {

0 commit comments

Comments
 (0)