Destroy widget when its permission is revoked
This commit is contained in:
parent
c1891aa005
commit
6804647dda
1 changed files with 13 additions and 5 deletions
|
@ -161,14 +161,18 @@ export default class AppTile extends React.Component {
|
||||||
// if it's not remaining on screen, get rid of the PersistedElement container
|
// if it's not remaining on screen, get rid of the PersistedElement container
|
||||||
if (!ActiveWidgetStore.getWidgetPersistence(this.props.id)) {
|
if (!ActiveWidgetStore.getWidgetPersistence(this.props.id)) {
|
||||||
// FIXME: ActiveWidgetStore should probably worry about this?
|
// FIXME: ActiveWidgetStore should probably worry about this?
|
||||||
const PersistedElement = sdk.getComponent("elements.PersistedElement");
|
this._destroyPersistentWidget();
|
||||||
PersistedElement.destroyElement(this._persistKey);
|
|
||||||
ActiveWidgetStore.delWidgetMessaging(this.props.id);
|
|
||||||
ActiveWidgetStore.delWidgetCapabilities(this.props.id);
|
|
||||||
ActiveWidgetStore.delRoomId(this.props.id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_destroyPersistentWidget() {
|
||||||
|
const PersistedElement = sdk.getComponent("elements.PersistedElement");
|
||||||
|
PersistedElement.destroyElement(this._persistKey);
|
||||||
|
ActiveWidgetStore.delWidgetMessaging(this.props.id);
|
||||||
|
ActiveWidgetStore.delWidgetCapabilities(this.props.id);
|
||||||
|
ActiveWidgetStore.delRoomId(this.props.id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a scalar token to the widget URL, if required
|
* Adds a scalar token to the widget URL, if required
|
||||||
* Component initialisation is only complete when this function has resolved
|
* Component initialisation is only complete when this function has resolved
|
||||||
|
@ -439,6 +443,10 @@ export default class AppTile extends React.Component {
|
||||||
console.warn('Revoking permission to load widget - ', this.state.widgetUrl);
|
console.warn('Revoking permission to load widget - ', this.state.widgetUrl);
|
||||||
localStorage.removeItem(this.state.widgetPermissionId);
|
localStorage.removeItem(this.state.widgetPermissionId);
|
||||||
this.setState({hasPermissionToLoad: false});
|
this.setState({hasPermissionToLoad: false});
|
||||||
|
|
||||||
|
// Force the widget to be non-persistent
|
||||||
|
ActiveWidgetStore.setWidgetPersistence(this.props.id, false);
|
||||||
|
this._destroyPersistentWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
formatAppTileName() {
|
formatAppTileName() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue