Add analytics for the ViewRoom action (#7666)
This commit is contained in:
parent
20e9d0c159
commit
0d6ef76605
53 changed files with 332 additions and 159 deletions
|
@ -54,6 +54,7 @@ import {
|
|||
import { getCachedRoomIDForAlias } from "../../RoomAliasCache";
|
||||
import { EffectiveMembership, getEffectiveMembership } from "../../utils/membership";
|
||||
import { PosthogAnalytics } from "../../PosthogAnalytics";
|
||||
import { ViewRoomPayload } from "../../dispatcher/payloads/ViewRoomPayload";
|
||||
|
||||
interface IState {}
|
||||
|
||||
|
@ -157,10 +158,11 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
|
||||
if (space) {
|
||||
const roomId = this.getNotificationState(space).getFirstRoomWithNotifications();
|
||||
defaultDispatcher.dispatch({
|
||||
defaultDispatcher.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: roomId,
|
||||
context_switch: true,
|
||||
_trigger: "WebSpaceContextSwitch",
|
||||
});
|
||||
} else {
|
||||
const lists = RoomListStore.instance.unfilteredLists;
|
||||
|
@ -174,10 +176,11 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
}
|
||||
});
|
||||
if (unreadRoom) {
|
||||
defaultDispatcher.dispatch({
|
||||
defaultDispatcher.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: unreadRoom.roomId,
|
||||
context_switch: true,
|
||||
_trigger: "WebSpaceContextSwitch",
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
@ -222,16 +225,18 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
this.matrixClient.getRoom(roomId)?.getMyMembership() === "join" &&
|
||||
this.isRoomInSpace(space, roomId)
|
||||
) {
|
||||
defaultDispatcher.dispatch({
|
||||
defaultDispatcher.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: roomId,
|
||||
context_switch: true,
|
||||
_trigger: "WebSpaceContextSwitch",
|
||||
});
|
||||
} else if (cliSpace) {
|
||||
defaultDispatcher.dispatch({
|
||||
defaultDispatcher.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: space,
|
||||
context_switch: true,
|
||||
_trigger: "WebSpaceContextSwitch",
|
||||
});
|
||||
} else {
|
||||
defaultDispatcher.dispatch({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue