Cast dispatcher payloads correctly when firing them

This commit is contained in:
Travis Ralston 2022-03-31 19:38:00 -06:00
parent d5e70dfaa5
commit 71b356a9a4
4 changed files with 10 additions and 10 deletions

View file

@ -1093,7 +1093,7 @@ export default class CallHandler extends EventEmitter {
*/ */
public showTransferDialog(call: MatrixCall): void { public showTransferDialog(call: MatrixCall): void {
call.setRemoteOnHold(true); call.setRemoteOnHold(true);
dis.dispatch({ dis.dispatch<OpenInviteDialogPayload>({
action: Action.OpenInviteDialog, action: Action.OpenInviteDialog,
kind: KIND_CALL_TRANSFER, kind: KIND_CALL_TRANSFER,
call, call,
@ -1104,7 +1104,7 @@ export default class CallHandler extends EventEmitter {
call.setRemoteOnHold(false); call.setRemoteOnHold(false);
} }
}, },
} as OpenInviteDialogPayload); });
} }
private addCallForRoom(roomId: string, call: MatrixCall, changedRooms = false): void { private addCallForRoom(roomId: string, call: MatrixCall, changedRooms = false): void {

View file

@ -154,10 +154,10 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
}; };
private onReportEventClick = (): void => { private onReportEventClick = (): void => {
dis.dispatch({ dis.dispatch<OpenReportEventDialogPayload>({
action: Action.OpenReportEventDialog, action: Action.OpenReportEventDialog,
event: this.props.mxEvent, event: this.props.mxEvent,
} as OpenReportEventDialogPayload); });
this.closeMenu(); this.closeMenu();
}; };
@ -178,11 +178,11 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
}; };
private onForwardClick = (): void => { private onForwardClick = (): void => {
dis.dispatch({ dis.dispatch<OpenForwardDialogPayload>({
action: Action.OpenForwardDialog, action: Action.OpenForwardDialog,
event: this.props.mxEvent, event: this.props.mxEvent,
permalinkCreator: this.props.permalinkCreator, permalinkCreator: this.props.permalinkCreator,
} as OpenForwardDialogPayload); });
this.closeMenu(); this.closeMenu();
}; };

View file

@ -157,11 +157,11 @@ export class RoomViewStore extends Store<ActionPayload> {
// Fired so we can reduce dependency on event emitters to this store, which is relatively // Fired so we can reduce dependency on event emitters to this store, which is relatively
// central to the application and can easily cause import cycles. // central to the application and can easily cause import cycles.
dis.dispatch({ dis.dispatch<ActiveRoomChangedPayload>({
action: Action.ActiveRoomChanged, action: Action.ActiveRoomChanged,
oldRoomId: lastRoomId, oldRoomId: lastRoomId,
newRoomId: this.state.roomId, newRoomId: this.state.roomId,
} as ActiveRoomChangedPayload); });
} }
this.__emitChange(); this.__emitChange();

View file

@ -66,10 +66,10 @@ export function showSpaceSettings(space: Room) {
} }
export const showAddExistingRooms = (space: Room): void => { export const showAddExistingRooms = (space: Room): void => {
dis.dispatch({ dis.dispatch<OpenAddExistingToSpaceDialogPayload>({
action: Action.OpenAddToExistingSpaceDialog, action: Action.OpenAddToExistingSpaceDialog,
space, space,
} as OpenAddExistingToSpaceDialogPayload); });
}; };
export const showCreateNewRoom = async (space: Room): Promise<boolean> => { export const showCreateNewRoom = async (space: Room): Promise<boolean> => {