From cdffbdb81ad5d44c4879820ce90b589d087fe996 Mon Sep 17 00:00:00 2001 From: Sahil Silare <32628578+sahil9001@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:31:10 +0530 Subject: [PATCH] Add error handling for room publish toggle (#12941) * feat: added error handling for room publish toggle * chore: fixed the messages and removed `console.log` * chore: added minor comment that was removed * fix: addressed review comments * fix: fixed linting --- .../views/room_settings/RoomPublishSetting.tsx | 10 ++++++++++ src/i18n/strings/en_EN.json | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/components/views/room_settings/RoomPublishSetting.tsx b/src/components/views/room_settings/RoomPublishSetting.tsx index 5fddb66a154..f97776bf94b 100644 --- a/src/components/views/room_settings/RoomPublishSetting.tsx +++ b/src/components/views/room_settings/RoomPublishSetting.tsx @@ -21,6 +21,8 @@ import LabelledToggleSwitch from "../elements/LabelledToggleSwitch"; import { _t } from "../../../languageHandler"; import { MatrixClientPeg } from "../../../MatrixClientPeg"; import DirectoryCustomisations from "../../../customisations/Directory"; +import Modal from "../../../Modal"; +import ErrorDialog from "../dialogs/ErrorDialog"; interface IProps { roomId: string; @@ -41,6 +43,13 @@ export default class RoomPublishSetting extends React.PureComponent { const valueBefore = this.state.isRoomPublished; const newValue = !valueBefore; @@ -50,6 +59,7 @@ export default class RoomPublishSetting extends React.PureComponent { + this.showError(); // Roll back the local echo on the change this.setState({ isRoomPublished: valueBefore }); }); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index b1f4fb46070..e1e44efc61d 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2214,6 +2214,8 @@ "error_deleting_alias_description": "There was an error removing that address. It may no longer exist or a temporary error occurred.", "error_deleting_alias_description_forbidden": "You don't have permission to delete the address.", "error_deleting_alias_title": "Error removing address", + "error_publishing": "Unable to publish room", + "error_publishing_detail": "There was an error publishing this room", "error_save_space_settings": "Failed to save space settings.", "error_updating_alias_description": "There was an error updating the room's alternative addresses. It may not be allowed by the server or a temporary failure occurred.", "error_updating_canonical_alias_description": "There was an error updating the room's main address. It may not be allowed by the server or a temporary failure occurred.",