From 28865e27bc30ba73b7fc1b4f4c0483a41b6b2a7e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 23 Apr 2020 15:24:20 -0600 Subject: [PATCH] Don't overwrite the 'domain' data key for all widgets Some widgets, which aren't Jitsi widgets, might need this to be something else. --- src/components/views/elements/AppTile.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index bf9054771c..366669a276 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -569,12 +569,14 @@ export default class AppTile extends React.Component { * * @returns {string} url with temlate variables replaced */ - _templatedUrl(u) { + _templatedUrl(u, widgetType: string) { + const targetData = {}; + if (WidgetType.JITSI.matches(widgetType)) { + targetData['domain'] = 'jitsi.riot.im'; // v1 jitsi widgets have this hardcoded + } const myUserId = MatrixClientPeg.get().credentials.userId; const myUser = MatrixClientPeg.get().getUser(myUserId); - const vars = Object.assign({ - domain: "jitsi.riot.im", // v1 widgets have this hardcoded - }, this.props.app.data, { + const vars = Object.assign(targetData, this.props.app.data, { 'matrix_user_id': myUserId, 'matrix_room_id': this.props.room.roomId, 'matrix_display_name': myUser ? myUser.displayName : myUserId, @@ -611,18 +613,19 @@ export default class AppTile extends React.Component { } else { url = this._getSafeUrl(this.state.widgetUrl); } - return this._templatedUrl(url); + return this._templatedUrl(url, this.props.app.type); } _getPopoutUrl() { if (WidgetType.JITSI.matches(this.props.app.type)) { return this._templatedUrl( WidgetUtils.getLocalJitsiWrapperUrl({forLocalRender: false}), + this.props.app.type ); } else { // use app.url, not state.widgetUrl, because we want the one without // the wURL params for the popped-out version. - return this._templatedUrl(this._getSafeUrl(this.props.app.url)); + return this._templatedUrl(this._getSafeUrl(this.props.app.url), this.props.app.type); } }