Merge pull request #5607 from matrix-org/jryans/tally-ho

Lock widget room ID when added
This commit is contained in:
J. Ryan Stinnett 2021-02-02 15:03:09 +00:00 committed by GitHub
commit ecc3dbbd80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 9 deletions

View file

@ -81,7 +81,7 @@
"linkifyjs": "^2.1.9", "linkifyjs": "^2.1.9",
"lodash": "^4.17.20", "lodash": "^4.17.20",
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
"matrix-widget-api": "^0.1.0-beta.12", "matrix-widget-api": "^0.1.0-beta.13",
"minimist": "^1.2.5", "minimist": "^1.2.5",
"pako": "^2.0.3", "pako": "^2.0.3",
"parse5": "^6.0.1", "parse5": "^6.0.1",

View file

@ -35,13 +35,13 @@ import {
} from "matrix-widget-api"; } from "matrix-widget-api";
import {StopGapWidgetDriver} from "../../../stores/widgets/StopGapWidgetDriver"; import {StopGapWidgetDriver} from "../../../stores/widgets/StopGapWidgetDriver";
import {MatrixClientPeg} from "../../../MatrixClientPeg"; import {MatrixClientPeg} from "../../../MatrixClientPeg";
import RoomViewStore from "../../../stores/RoomViewStore";
import {OwnProfileStore} from "../../../stores/OwnProfileStore"; import {OwnProfileStore} from "../../../stores/OwnProfileStore";
import { arrayFastClone } from "../../../utils/arrays"; import { arrayFastClone } from "../../../utils/arrays";
import { ElementWidget } from "../../../stores/widgets/StopGapWidget"; import { ElementWidget } from "../../../stores/widgets/StopGapWidget";
interface IProps { interface IProps {
widgetDefinition: IModalWidgetOpenRequestData; widgetDefinition: IModalWidgetOpenRequestData;
widgetRoomId?: string;
sourceWidgetId: string; sourceWidgetId: string;
onFinished(success: boolean, data?: IModalWidgetReturnData): void; onFinished(success: boolean, data?: IModalWidgetReturnData): void;
} }
@ -123,7 +123,7 @@ export default class ModalWidgetDialog extends React.PureComponent<IProps, IStat
public render() { public render() {
const templated = this.widget.getCompleteUrl({ const templated = this.widget.getCompleteUrl({
currentRoomId: RoomViewStore.getRoomId(), widgetRoomId: this.props.widgetRoomId,
currentUserId: MatrixClientPeg.get().getUserId(), currentUserId: MatrixClientPeg.get().getUserId(),
userDisplayName: OwnProfileStore.instance.displayName, userDisplayName: OwnProfileStore.instance.displayName,
userHttpAvatarUrl: OwnProfileStore.instance.getHttpAvatarUrl(), userHttpAvatarUrl: OwnProfileStore.instance.getHttpAvatarUrl(),

View file

@ -48,11 +48,16 @@ export class ModalWidgetStore extends AsyncStoreWithClient<IState> {
return !this.modalInstance; return !this.modalInstance;
}; };
public openModalWidget = (requestData: IModalWidgetOpenRequestData, sourceWidget: Widget) => { public openModalWidget = (
requestData: IModalWidgetOpenRequestData,
sourceWidget: Widget,
widgetRoomId?: string,
) => {
if (this.modalInstance) return; if (this.modalInstance) return;
this.openSourceWidgetId = sourceWidget.id; this.openSourceWidgetId = sourceWidget.id;
this.modalInstance = Modal.createTrackedDialog('Modal Widget', '', ModalWidgetDialog, { this.modalInstance = Modal.createTrackedDialog('Modal Widget', '', ModalWidgetDialog, {
widgetDefinition: {...requestData}, widgetDefinition: {...requestData},
widgetRoomId,
sourceWidgetId: sourceWidget.id, sourceWidgetId: sourceWidget.id,
onFinished: (success: boolean, data?: IModalWidgetReturnData) => { onFinished: (success: boolean, data?: IModalWidgetReturnData) => {
if (!success) { if (!success) {

View file

@ -190,7 +190,7 @@ export class StopGapWidget extends EventEmitter {
private runUrlTemplate(opts = {asPopout: false}): string { private runUrlTemplate(opts = {asPopout: false}): string {
const templated = this.mockWidget.getCompleteUrl({ const templated = this.mockWidget.getCompleteUrl({
currentRoomId: RoomViewStore.getRoomId(), widgetRoomId: this.roomId,
currentUserId: MatrixClientPeg.get().getUserId(), currentUserId: MatrixClientPeg.get().getUserId(),
userDisplayName: OwnProfileStore.instance.displayName, userDisplayName: OwnProfileStore.instance.displayName,
userHttpAvatarUrl: OwnProfileStore.instance.getHttpAvatarUrl(), userHttpAvatarUrl: OwnProfileStore.instance.getHttpAvatarUrl(),

View file

@ -5604,10 +5604,10 @@ matrix-react-test-utils@^0.2.2:
resolved "https://registry.yarnpkg.com/matrix-react-test-utils/-/matrix-react-test-utils-0.2.2.tgz#c87144d3b910c7edc544a6699d13c7c2bf02f853" resolved "https://registry.yarnpkg.com/matrix-react-test-utils/-/matrix-react-test-utils-0.2.2.tgz#c87144d3b910c7edc544a6699d13c7c2bf02f853"
integrity sha512-49+7gfV6smvBIVbeloql+37IeWMTD+fiywalwCqk8Dnz53zAFjKSltB3rmWHso1uecLtQEcPtCijfhzcLXAxTQ== integrity sha512-49+7gfV6smvBIVbeloql+37IeWMTD+fiywalwCqk8Dnz53zAFjKSltB3rmWHso1uecLtQEcPtCijfhzcLXAxTQ==
matrix-widget-api@^0.1.0-beta.12: matrix-widget-api@^0.1.0-beta.13:
version "0.1.0-beta.12" version "0.1.0-beta.13"
resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-0.1.0-beta.12.tgz#6cadeabde14f02949b7c3177434a4755942559b8" resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-0.1.0-beta.13.tgz#ebddc83eaef39bbb87b621a02a35902e1a29b9ef"
integrity sha512-43xVAzLYzddYF73r6NK7NZ3geDLshQqCNAAcv0t5LFyFkKYGWDQG/cg8Vn8d37wm9WVBqYZUOXy9vBD4JcWVPA== integrity sha512-DJAvuX2E7gxc/a9rtJPDh17ba9xGIOAoBHcWirNTN3KGodzsrZ+Ns+M/BREFWMwGS5yEBZko5eq7uhXStEbnyQ==
dependencies: dependencies:
"@types/events" "^3.0.0" "@types/events" "^3.0.0"
events "^3.2.0" events "^3.2.0"