From 99b0a0a78e77342728b1c7c9f4d399ebf99e81a7 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 9 Sep 2020 15:35:05 +0100 Subject: [PATCH 1/2] 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. --- src/components/views/elements/AppTile.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 1c93841afb..14f752620a 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -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 From f9079975a1dcbd23edc5887bd163c3d27234b1da Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 9 Sep 2020 15:42:25 +0100 Subject: [PATCH 2/2] write correct jsdoc --- src/components/views/elements/AppTile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 14f752620a..8dc0363435 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -605,7 +605,7 @@ export default class AppTile extends React.Component { /** * 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 + * @returns {bool} true If using a local version of the widget */ _usingLocalWidget() { return WidgetType.JITSI.matches(this.props.app.type);