Skip to content

Commit 34a0757

Browse files
authored
Merge pull request matrix-org#5306 from matrix-org/travis/rel/5305
[Release] Fix templating for v1 jitsi widgets
2 parents f528a16 + 3e7f117 commit 34a0757

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/stores/widgets/StopGapWidget.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ import {
1919
ClientWidgetApi,
2020
IStickerActionRequest,
2121
IStickyActionRequest,
22+
ITemplateParams,
2223
IWidget,
2324
IWidgetApiRequest,
2425
IWidgetApiRequestEmptyData,
2526
IWidgetData,
2627
MatrixCapabilities,
28+
runTemplate,
2729
Widget,
2830
WidgetApiFromWidgetAction,
2931
} from "matrix-widget-api";
@@ -76,15 +78,33 @@ class ElementWidget extends Widget {
7678
let conferenceId = super.rawData['conferenceId'];
7779
if (conferenceId === undefined) {
7880
// we'll need to parse the conference ID out of the URL for v1 Jitsi widgets
79-
const parsedUrl = new URL(this.templateUrl);
81+
const parsedUrl = new URL(super.templateUrl); // use super to get the raw widget URL
8082
conferenceId = parsedUrl.searchParams.get("confId");
8183
}
84+
let domain = super.rawData['domain'];
85+
if (domain === undefined) {
86+
// v1 widgets default to jitsi.riot.im regardless of user settings
87+
domain = "jitsi.riot.im";
88+
}
8289
return {
8390
...super.rawData,
8491
theme: SettingsStore.getValue("theme"),
8592
conferenceId,
93+
domain,
8694
};
8795
}
96+
97+
public getCompleteUrl(params: ITemplateParams): string {
98+
return runTemplate(this.templateUrl, {
99+
// we need to supply a whole widget to the template, but don't have
100+
// easy access to the definition the superclass is using, so be sad
101+
// and gutwrench it.
102+
// This isn't a problem when the widget architecture is fixed and this
103+
// subclass gets deleted.
104+
...super['definition'], // XXX: Private member access
105+
data: this.rawData,
106+
}, params);
107+
}
88108
}
89109

90110
export class StopGapWidget extends EventEmitter {

0 commit comments

Comments
 (0)