Add error dialog if widget remove fails

Also up the timeout because matrix.org is that slow
This commit is contained in:
David Baker 2018-07-03 11:55:41 +01:00
parent 9d41b87678
commit c665ab8a22
3 changed files with 13 additions and 2 deletions

View file

@ -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});
});

View file

@ -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",

View file

@ -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);
});
}