Add error dialog if widget remove fails
Also up the timeout because matrix.org is that slow
This commit is contained in:
parent
9d41b87678
commit
c665ab8a22
3 changed files with 13 additions and 2 deletions
|
@ -325,6 +325,12 @@ export default class AppTile extends React.Component {
|
||||||
this.props.id,
|
this.props.id,
|
||||||
).catch((e) => {
|
).catch((e) => {
|
||||||
console.error('Failed to delete widget', 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(() => {
|
}).finally(() => {
|
||||||
this.setState({deleting: false});
|
this.setState({deleting: false});
|
||||||
});
|
});
|
||||||
|
|
|
@ -205,6 +205,8 @@
|
||||||
"Your browser does not support the required cryptography extensions": "Your browser does not support the required cryptography extensions",
|
"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",
|
"Not a valid Riot keyfile": "Not a valid Riot keyfile",
|
||||||
"Authentication check failed: incorrect password?": "Authentication check failed: incorrect password?",
|
"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",
|
"Failed to join room": "Failed to join room",
|
||||||
"Message Pinning": "Message Pinning",
|
"Message Pinning": "Message Pinning",
|
||||||
"Jitsi Conference Calling": "Jitsi Conference Calling",
|
"Jitsi Conference Calling": "Jitsi Conference Calling",
|
||||||
|
|
|
@ -21,6 +21,9 @@ import dis from '../dispatcher';
|
||||||
import * as url from "url";
|
import * as url from "url";
|
||||||
import WidgetEchoStore from '../stores/WidgetEchoStore';
|
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 {
|
export default class WidgetUtils {
|
||||||
/* Returns true if user is able to send state events to modify widgets in this room
|
/* 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)
|
* (Does not apply to non-room-based / user widgets)
|
||||||
|
@ -135,7 +138,7 @@ export default class WidgetUtils {
|
||||||
const timerId = setTimeout(() => {
|
const timerId = setTimeout(() => {
|
||||||
MatrixClientPeg.get().removeListener('accountData', onAccountData);
|
MatrixClientPeg.get().removeListener('accountData', onAccountData);
|
||||||
reject(new Error("Timed out waiting for widget ID " + widgetId + " to appear"));
|
reject(new Error("Timed out waiting for widget ID " + widgetId + " to appear"));
|
||||||
}, 10000);
|
}, WIDGET_WAIT_TIME);
|
||||||
MatrixClientPeg.get().on('accountData', onAccountData);
|
MatrixClientPeg.get().on('accountData', onAccountData);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -188,7 +191,7 @@ export default class WidgetUtils {
|
||||||
const timerId = setTimeout(() => {
|
const timerId = setTimeout(() => {
|
||||||
MatrixClientPeg.get().removeListener('RoomState.events', onRoomStateEvents);
|
MatrixClientPeg.get().removeListener('RoomState.events', onRoomStateEvents);
|
||||||
reject(new Error("Timed out waiting for widget ID " + widgetId + " to appear"));
|
reject(new Error("Timed out waiting for widget ID " + widgetId + " to appear"));
|
||||||
}, 10000);
|
}, WIDGET_WAIT_TIME);
|
||||||
MatrixClientPeg.get().on('RoomState.events', onRoomStateEvents);
|
MatrixClientPeg.get().on('RoomState.events', onRoomStateEvents);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue