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 {
call.setRemoteOnHold(true);
dis.dispatch({
dis.dispatch<OpenInviteDialogPayload>({
action: Action.OpenInviteDialog,
kind: KIND_CALL_TRANSFER,
call,
@ -1104,7 +1104,7 @@ export default class CallHandler extends EventEmitter {
call.setRemoteOnHold(false);
}
},
} as OpenInviteDialogPayload);
});
}
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 => {
dis.dispatch({
dis.dispatch<OpenReportEventDialogPayload>({
action: Action.OpenReportEventDialog,
event: this.props.mxEvent,
} as OpenReportEventDialogPayload);
});
this.closeMenu();
};
@ -178,11 +178,11 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
};
private onForwardClick = (): void => {
dis.dispatch({
dis.dispatch<OpenForwardDialogPayload>({
action: Action.OpenForwardDialog,
event: this.props.mxEvent,
permalinkCreator: this.props.permalinkCreator,
} as OpenForwardDialogPayload);
});
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
// central to the application and can easily cause import cycles.
dis.dispatch({
dis.dispatch<ActiveRoomChangedPayload>({
action: Action.ActiveRoomChanged,
oldRoomId: lastRoomId,
newRoomId: this.state.roomId,
} as ActiveRoomChangedPayload);
});
}
this.__emitChange();

View file

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