Always allow widgets when using the local version

Since we're not loading the widget URL, there's no need to ask
for permission to load it: it's just another part of the app.
pull/21833/head
David Baker 2020-09-09 15:35:05 +01:00
parent 83c2ae2479
commit 99b0a0a78e
1 changed files with 11 additions and 0 deletions

View File

@ -100,6 +100,8 @@ export default class AppTile extends React.Component {
_getNewState(newProps) {
// This is a function to make the impact of calling SettingsStore slightly less
const hasPermissionToLoad = () => {
if (this._usingLocalWidget()) return true;
const currentlyAllowedWidgets = SettingsStore.getValue("allowedWidgets", newProps.room.roomId);
return !!currentlyAllowedWidgets[newProps.app.eventId];
};
@ -600,6 +602,15 @@ export default class AppTile extends React.Component {
return uriFromTemplate(u, vars);
}
/**
* Whether we're using a local version of the widget rather than loading the
* actual widget URL
* @returns true If using a local version of the widget
*/
_usingLocalWidget() {
return WidgetType.JITSI.matches(this.props.app.type);
}
/**
* Get the URL used in the iframe
* In cases where we supply our own UI for a widget, this is an internal