Add ActionPayload type

This commit is contained in:
J. Ryan Stinnett 2021-04-26 15:21:49 +01:00
parent 01cfd9361e
commit bf43144f6e
2 changed files with 5 additions and 3 deletions

View file

@ -22,6 +22,7 @@ import {MatrixEvent} from "matrix-js-sdk/src/models/event";
import {Room} from "matrix-js-sdk/src/models/room";
import {RoomMember} from "matrix-js-sdk/src/models/room-member";
import dis from '../../../dispatcher/dispatcher';
import { ActionPayload } from "../../../dispatcher/payloads";
import Stickerpicker from './Stickerpicker';
import { makeRoomPermalink, RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks';
import ContentMessages from '../../../ContentMessages';
@ -121,7 +122,7 @@ class UploadButton extends React.Component<IUploadButtonProps> {
dis.unregister(this.dispatcherRef);
}
private onAction = payload => {
private onAction = (payload: ActionPayload) => {
if (payload.action === "upload_file") {
this.onUploadClick();
}
@ -217,7 +218,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
this.waitForOwnMember();
}
private onAction = (payload) => {
private onAction = (payload: ActionPayload) => {
if (payload.action === 'reply_to_event') {
// add a timeout for the reply preview to be rendered, so
// that the ScrollPanel listening to the resizeNotifier can

View file

@ -27,6 +27,7 @@ import {abbreviateUrl, unabbreviateUrl} from "../../../utils/UrlUtils";
import { getDefaultIdentityServerUrl, doesIdentityServerHaveTerms } from '../../../utils/IdentityServerUtils';
import {timeout} from "../../../utils/promise";
import {replaceableComponent} from "../../../utils/replaceableComponent";
import { ActionPayload } from '../../../dispatcher/payloads';
// We'll wait up to this long when checking for 3PID bindings on the IS.
const REACHABILITY_TIMEOUT = 10000; // ms
@ -107,7 +108,7 @@ export default class SetIdServer extends React.Component<IProps, IState> {
dis.unregister(this.dispatcherRef);
}
private onAction = (payload) => {
private onAction = (payload: ActionPayload) => {
// We react to changes in the ID server in the event the user is staring at this form
// when changing their identity server on another device.
if (payload.action !== "id_server_changed") return;