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 {Room} from "matrix-js-sdk/src/models/room";
import {RoomMember} from "matrix-js-sdk/src/models/room-member"; import {RoomMember} from "matrix-js-sdk/src/models/room-member";
import dis from '../../../dispatcher/dispatcher'; import dis from '../../../dispatcher/dispatcher';
import { ActionPayload } from "../../../dispatcher/payloads";
import Stickerpicker from './Stickerpicker'; import Stickerpicker from './Stickerpicker';
import { makeRoomPermalink, RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks'; import { makeRoomPermalink, RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks';
import ContentMessages from '../../../ContentMessages'; import ContentMessages from '../../../ContentMessages';
@ -121,7 +122,7 @@ class UploadButton extends React.Component<IUploadButtonProps> {
dis.unregister(this.dispatcherRef); dis.unregister(this.dispatcherRef);
} }
private onAction = payload => { private onAction = (payload: ActionPayload) => {
if (payload.action === "upload_file") { if (payload.action === "upload_file") {
this.onUploadClick(); this.onUploadClick();
} }
@ -217,7 +218,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
this.waitForOwnMember(); this.waitForOwnMember();
} }
private onAction = (payload) => { private onAction = (payload: ActionPayload) => {
if (payload.action === 'reply_to_event') { if (payload.action === 'reply_to_event') {
// add a timeout for the reply preview to be rendered, so // add a timeout for the reply preview to be rendered, so
// that the ScrollPanel listening to the resizeNotifier can // 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 { getDefaultIdentityServerUrl, doesIdentityServerHaveTerms } from '../../../utils/IdentityServerUtils';
import {timeout} from "../../../utils/promise"; import {timeout} from "../../../utils/promise";
import {replaceableComponent} from "../../../utils/replaceableComponent"; 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. // We'll wait up to this long when checking for 3PID bindings on the IS.
const REACHABILITY_TIMEOUT = 10000; // ms const REACHABILITY_TIMEOUT = 10000; // ms
@ -107,7 +108,7 @@ export default class SetIdServer extends React.Component<IProps, IState> {
dis.unregister(this.dispatcherRef); 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 // 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. // when changing their identity server on another device.
if (payload.action !== "id_server_changed") return; if (payload.action !== "id_server_changed") return;