mirror of
https://github.com/element-hq/element-web.git
synced 2024-11-30 23:31:28 +03:00
Fix url encoding issue for modal widgets widgetId
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
fbbba75f81
commit
e3b0bf1915
3 changed files with 8 additions and 3 deletions
2
src/@types/global.d.ts
vendored
2
src/@types/global.d.ts
vendored
|
@ -30,6 +30,7 @@ import {Notifier} from "../Notifier";
|
||||||
import type {Renderer} from "react-dom";
|
import type {Renderer} from "react-dom";
|
||||||
import RightPanelStore from "../stores/RightPanelStore";
|
import RightPanelStore from "../stores/RightPanelStore";
|
||||||
import WidgetStore from "../stores/WidgetStore";
|
import WidgetStore from "../stores/WidgetStore";
|
||||||
|
import {ModalWidgetStore} from "../stores/ModalWidgetStore";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
|
@ -53,6 +54,7 @@ declare global {
|
||||||
mxNotifier: typeof Notifier;
|
mxNotifier: typeof Notifier;
|
||||||
mxRightPanelStore: RightPanelStore;
|
mxRightPanelStore: RightPanelStore;
|
||||||
mxWidgetStore: WidgetStore;
|
mxWidgetStore: WidgetStore;
|
||||||
|
mxModalWidgetStore: ModalWidgetStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Document {
|
interface Document {
|
||||||
|
|
|
@ -83,8 +83,9 @@ export default class ModalWidgetDialog extends React.PureComponent<IProps, IStat
|
||||||
public render() {
|
public render() {
|
||||||
// TODO: Don't violate every single security principle
|
// TODO: Don't violate every single security principle
|
||||||
|
|
||||||
const widgetUrl = this.props.widgetDefinition.url
|
const widgetId = encodeURIComponent(this.getWidgetId());
|
||||||
+ `?widgetId=${this.getWidgetId()}&parentUrl=${encodeURIComponent(window.location.href)}`;
|
const parentUrl = encodeURIComponent(window.location.href);
|
||||||
|
const widgetUrl = `${this.props.widgetDefinition.url}?widgetId=${widgetId}&parentUrl=${parentUrl}`;
|
||||||
|
|
||||||
let buttons;
|
let buttons;
|
||||||
if (this.props.widgetDefinition.buttons) {
|
if (this.props.widgetDefinition.buttons) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ export class ModalWidgetStore extends AsyncStoreWithClient<IState> {
|
||||||
this.openSourceWidgetId = sourceWidgetId;
|
this.openSourceWidgetId = sourceWidgetId;
|
||||||
this.modalInstance = Modal.createTrackedDialog('Modal Widget', '', ModalWidgetDialog, {
|
this.modalInstance = Modal.createTrackedDialog('Modal Widget', '', ModalWidgetDialog, {
|
||||||
widgetDefinition: {...requestData},
|
widgetDefinition: {...requestData},
|
||||||
sourceWidgetId: sourceWidgetId,
|
sourceWidgetId,
|
||||||
onFinished: (success: boolean, data?: any) => {
|
onFinished: (success: boolean, data?: any) => {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
this.closeModalWidget(sourceWidgetId, {
|
this.closeModalWidget(sourceWidgetId, {
|
||||||
|
@ -84,3 +84,5 @@ export class ModalWidgetStore extends AsyncStoreWithClient<IState> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.mxModalWidgetStore = ModalWidgetStore.instance;
|
||||||
|
|
Loading…
Reference in a new issue