diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 7b69057e3e..1eaa1837ed 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -325,6 +325,12 @@ export default class AppTile extends React.Component { this.props.id, ).catch((e) => { console.error('Failed to delete widget', e); + const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + + Modal.createTrackedDialog('Failed to remove widget', '', ErrorDialog, { + title: _t('Failed to remove widget'), + description: _t('An error ocurred whilst trying to remove the widget from the room'), + }); }).finally(() => { this.setState({deleting: false}); }); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index b73cf037c8..2cab44fafb 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -205,6 +205,8 @@ "Your browser does not support the required cryptography extensions": "Your browser does not support the required cryptography extensions", "Not a valid Riot keyfile": "Not a valid Riot keyfile", "Authentication check failed: incorrect password?": "Authentication check failed: incorrect password?", + "Failed to remove widget": "Failed to remove widget", + "An error ocurred whilst trying to remove the widget from the room": "An error ocurred whilst trying to remove the widget from the room", "Failed to join room": "Failed to join room", "Message Pinning": "Message Pinning", "Jitsi Conference Calling": "Jitsi Conference Calling", diff --git a/src/utils/WidgetUtils.js b/src/utils/WidgetUtils.js index 43ca20e886..4effa21fd6 100644 --- a/src/utils/WidgetUtils.js +++ b/src/utils/WidgetUtils.js @@ -21,6 +21,9 @@ import dis from '../dispatcher'; import * as url from "url"; import WidgetEchoStore from '../stores/WidgetEchoStore'; +// How long we wait for the state event echo to come back from the server +const WIDGET_WAIT_TIME = 20000; + export default class WidgetUtils { /* Returns true if user is able to send state events to modify widgets in this room * (Does not apply to non-room-based / user widgets) @@ -135,7 +138,7 @@ export default class WidgetUtils { const timerId = setTimeout(() => { MatrixClientPeg.get().removeListener('accountData', onAccountData); reject(new Error("Timed out waiting for widget ID " + widgetId + " to appear")); - }, 10000); + }, WIDGET_WAIT_TIME); MatrixClientPeg.get().on('accountData', onAccountData); }); } @@ -188,7 +191,7 @@ export default class WidgetUtils { const timerId = setTimeout(() => { MatrixClientPeg.get().removeListener('RoomState.events', onRoomStateEvents); reject(new Error("Timed out waiting for widget ID " + widgetId + " to appear")); - }, 10000); + }, WIDGET_WAIT_TIME); MatrixClientPeg.get().on('RoomState.events', onRoomStateEvents); }); }