Documentation and symbolic constants for dispatcher actions (#31278)
* Remove unreachable code `view_last_screen` is never used. * Remove unused action `user_activity_started` Nothing listens to this, so it's pointless. * Symbolic constant for `Action.UserActivity` * Define symbolic constants for more `Action`s Constants for some actions that are emitted by `Lifecycle`
This commit is contained in:
committed by
GitHub
parent
c203f02731
commit
1285b73be6
@@ -18,6 +18,7 @@ import { MatrixClientPeg } from "../../MatrixClientPeg";
|
||||
import MatrixClientContext from "../../contexts/MatrixClientContext";
|
||||
import AutoHideScrollbar from "./AutoHideScrollbar";
|
||||
import { type ActionPayload } from "../../dispatcher/payloads";
|
||||
import { Action } from "../../dispatcher/actions.ts";
|
||||
|
||||
interface IProps {
|
||||
// URL to request embedded page content from
|
||||
@@ -109,7 +110,7 @@ export default class EmbeddedPage extends React.PureComponent<IProps, IState> {
|
||||
|
||||
private onAction = (payload: ActionPayload): void => {
|
||||
// HACK: Workaround for the context's MatrixClient not being set up at render time.
|
||||
if (payload.action === "client_started") {
|
||||
if (payload.action === Action.ClientStarted) {
|
||||
this.forceUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -812,13 +812,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "view_last_screen":
|
||||
// This function does what we want, despite the name. The idea is that it shows
|
||||
// the last room we were looking at or some reasonable default/guess. We don't
|
||||
// have to worry about email invites or similar being re-triggered because the
|
||||
// function will have cleared that state and not execute that path.
|
||||
this.showScreenAfterLogin();
|
||||
break;
|
||||
case "hide_left_panel":
|
||||
this.setState(
|
||||
{
|
||||
@@ -856,13 +849,13 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||
this.onLoggedIn();
|
||||
}
|
||||
break;
|
||||
case "on_client_not_viable":
|
||||
case Action.ClientNotViable:
|
||||
this.onSoftLogout();
|
||||
break;
|
||||
case Action.OnLoggedOut:
|
||||
this.onLoggedOut();
|
||||
break;
|
||||
case "will_start_client":
|
||||
case Action.WillStartClient:
|
||||
this.setState({ ready: false }, () => {
|
||||
// if the client is about to start, we are, by definition, not ready.
|
||||
// Set ready to false now, then it'll be set to true when the sync
|
||||
@@ -870,7 +863,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||
this.onWillStartClient();
|
||||
});
|
||||
break;
|
||||
case "client_started":
|
||||
case Action.ClientStarted:
|
||||
// No need to make this handler async to wait for the result of this
|
||||
this.onClientStarted().catch((e) => {
|
||||
logger.error("Exception in onClientStarted", e);
|
||||
|
||||
Reference in New Issue
Block a user