Don't supply popout widgets with widget parameters

Fixes https://github.com/vector-im/element-web/issues/15443
pull/21833/head
Travis Ralston 2020-10-14 13:54:27 -06:00
parent 7ef4de3115
commit aa28459b5a
1 changed files with 11 additions and 8 deletions

View File

@ -161,10 +161,12 @@ export class StopGapWidget extends EventEmitter {
userHttpAvatarUrl: OwnProfileStore.instance.getHttpAvatarUrl(), userHttpAvatarUrl: OwnProfileStore.instance.getHttpAvatarUrl(),
}, opts?.asPopout); }, opts?.asPopout);
// Add in some legacy support sprinkles const parsed = new URL(templated);
// Add in some legacy support sprinkles (for non-popout widgets)
// TODO: Replace these with proper widget params // TODO: Replace these with proper widget params
// See https://github.com/matrix-org/matrix-doc/pull/1958/files#r405714833 // See https://github.com/matrix-org/matrix-doc/pull/1958/files#r405714833
const parsed = new URL(templated); if (!opts?.asPopout) {
parsed.searchParams.set('widgetId', this.mockWidget.id); parsed.searchParams.set('widgetId', this.mockWidget.id);
parsed.searchParams.set('parentUrl', window.location.href.split('#', 2)[0]); parsed.searchParams.set('parentUrl', window.location.href.split('#', 2)[0]);
@ -173,6 +175,7 @@ export class StopGapWidget extends EventEmitter {
if (this.scalarToken) { if (this.scalarToken) {
parsed.searchParams.set('scalar_token', this.scalarToken); parsed.searchParams.set('scalar_token', this.scalarToken);
} }
}
// Replace the encoded dollar signs back to dollar signs. They have no special meaning // Replace the encoded dollar signs back to dollar signs. They have no special meaning
// in HTTP, but URL parsers encode them anyways. // in HTTP, but URL parsers encode them anyways.