Intercept cases of disabled/no integration managers

We already intercepted most of the cases where no integration manager was present, though there was a bug in many components where openAll() would be called regardless of an integration manager being available.

The integration manager being disabled by the user is handled in the IntegrationManager classes rather than on click because we have quite a few calls to these functions. The StickerPicker is an exception because it does slightly different behaviour.

This also removes the old "no integration manager configured" state from the IntegrationManager component as it is now replaced by a dialog.
This commit is contained in:
Travis Ralston 2019-11-20 20:40:39 -07:00
parent 81c9bdd9f3
commit 94fed922cf
7 changed files with 147 additions and 22 deletions

View file

@ -77,7 +77,7 @@ export default class Stickerpicker extends React.Component {
this._imError(_td("Failed to connect to integration manager"), e);
});
} else {
this._imError(_td("No integration manager is configured to manage stickers with"));
IntegrationManagers.sharedInstance().openNoManagerDialog();
}
}
@ -293,6 +293,11 @@ export default class Stickerpicker extends React.Component {
* @param {Event} e Event that triggered the function
*/
_onShowStickersClick(e) {
if (!SettingsStore.getValue("integrationProvisioning")) {
// Intercept this case and spawn a warning.
return IntegrationManagers.sharedInstance().showDisabledDialog();
}
// XXX: Simplify by using a context menu that is positioned relative to the sticker picker button
const buttonRect = e.target.getBoundingClientRect();