type Actions (#7862)

* type ViewHomPage action

Signed-off-by: Kerry Archibald <kerrya@element.io>

* type spacestore actions

Signed-off-by: Kerry Archibald <kerrya@element.io>

* lint

Signed-off-by: Kerry Archibald <kerrya@element.io>

* add action types

Signed-off-by: Kerry Archibald <kerrya@element.io>

* use new action types in stores

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove debug change

Signed-off-by: Kerry Archibald <kerrya@element.io>

* stricter keyboard shortcut types

Signed-off-by: Kerry Archibald <kerrya@element.io>

* action comments

Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
Kerry 2022-02-22 11:04:27 +01:00 committed by GitHub
parent 57595bc593
commit 5b8d440406
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 304 additions and 73 deletions

View file

@ -30,6 +30,7 @@ import { isMetaSpace } from "../stores/spaces";
import SpaceStore from "../stores/spaces/SpaceStore";
import { Action } from "../dispatcher/actions";
import { ViewRoomPayload } from "../dispatcher/payloads/ViewRoomPayload";
import { ViewHomePagePayload } from "../dispatcher/payloads/ViewHomePagePayload";
/**
* Approximation of a membership status for a given room.
@ -194,6 +195,6 @@ export async function leaveRoomBehaviour(roomId: string, retry = true, spinner =
metricsTrigger: undefined, // other
});
} else {
dis.dispatch({ action: 'view_home_page' });
dis.dispatch<ViewHomePagePayload>({ action: Action.ViewHomePage });
}
}

View file

@ -43,6 +43,7 @@ import CreateSpaceFromCommunityDialog from "../components/views/dialogs/CreateSp
import SpacePreferencesDialog, { SpacePreferenceTab } from "../components/views/dialogs/SpacePreferencesDialog";
import PosthogTrackers from "../PosthogTrackers";
import { ButtonEvent } from "../components/views/elements/AccessibleButton";
import { AfterLeaveRoomPayload } from "../dispatcher/payloads/AfterLeaveRoomPayload";
export const shouldShowSpaceSettings = (space: Room) => {
const userId = space.client.getUserId();
@ -189,8 +190,8 @@ export const leaveSpace = (space: Room) => {
if (!leave) return;
await bulkSpaceBehaviour(space, rooms, room => leaveRoomBehaviour(room.roomId));
dis.dispatch({
action: "after_leave_room",
dis.dispatch<AfterLeaveRoomPayload>({
action: Action.AfterLeaveRoom,
room_id: space.roomId,
});
},