More posthog tracking around joining rooms and room search (#7807)

This commit is contained in:
Michael Telatynski 2022-02-17 18:03:27 +00:00 committed by GitHub
parent e997676ae2
commit 658590e5bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 276 additions and 116 deletions

View file

@ -1084,7 +1084,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
dis.dispatch<ViewRoomPayload>({
action: Action.ViewRoom,
room_id: dmRooms[0],
_trigger: "MessageUser",
metricsTrigger: "MessageUser",
});
} else {
dis.dispatch({
@ -1356,7 +1356,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
dis.dispatch<ViewRoomPayload>({
action: Action.ViewRoom,
room_id: localStorage.getItem('mx_last_room_id'),
_trigger: undefined, // other
metricsTrigger: undefined, // other
});
}
@ -1797,7 +1797,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
},
room_alias: undefined,
room_id: undefined,
_trigger: undefined, // unknown or external trigger
metricsTrigger: undefined, // unknown or external trigger
};
if (roomString[0] === '#') {
payload.room_alias = roomString;

View file

@ -489,7 +489,7 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
action: Action.ViewRoom,
auto_join: autoJoin,
should_peek: shouldPeek,
_trigger: "RoomDirectory",
metricsTrigger: "RoomDirectory",
};
if (room) {
// Don't let the user view a room they won't be able to either

View file

@ -102,6 +102,7 @@ import { RightPanelPhases } from '../../stores/right-panel/RightPanelStorePhases
import { ActionPayload } from "../../dispatcher/payloads";
import { KeyBindingAction } from "../../accessibility/KeyboardShortcuts";
import { ViewRoomPayload } from "../../dispatcher/payloads/ViewRoomPayload";
import { JoinRoomPayload } from "../../dispatcher/payloads/JoinRoomPayload";
const DEBUG = false;
let debuglog = function(msg: string) {};
@ -776,7 +777,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
event_id: this.state.initialEventId,
highlighted: false,
replyingToEvent: this.state.replyToEvent,
_trigger: undefined, // room doesn't change
metricsTrigger: undefined, // room doesn't change
});
}
};
@ -879,7 +880,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
action: Action.ViewRoom,
room_id: roomId,
deferred_action: payload,
_trigger: "MessageSearch",
metricsTrigger: "MessageSearch",
});
});
}
@ -1179,7 +1180,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
dis.dispatch<ViewRoomPayload>({
action: Action.ViewRoom,
room_id: this.state.room.roomId,
_trigger: undefined, // room doesn't change
metricsTrigger: undefined, // room doesn't change
});
return; // this event cannot affect permissions so bail
}
@ -1283,10 +1284,11 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
} else {
Promise.resolve().then(() => {
const signUrl = this.props.threepidInvite?.signUrl;
dis.dispatch({
dis.dispatch<JoinRoomPayload>({
action: Action.JoinRoom,
roomId: this.getRoomId(),
opts: { inviteSignUrl: signUrl },
metricsTrigger: this.state.room?.getMyMembership() === "invite" ? "Invite" : "RoomPreview",
});
return Promise.resolve();
});
@ -1651,7 +1653,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
dis.dispatch<ViewRoomPayload>({
action: Action.ViewRoom,
room_id: this.state.room.roomId,
_trigger: undefined, // room doesn't change
metricsTrigger: undefined, // room doesn't change
});
} else {
// Otherwise we have to jump manually
@ -1787,7 +1789,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
dis.dispatch<ViewRoomPayload>({
action: Action.ViewRoom,
room_id: oldRoom.roomId,
_trigger: "Predecessor",
metricsTrigger: "Predecessor",
});
};

View file

@ -63,6 +63,7 @@ import { IOOBData } from "../../stores/ThreepidInviteStore";
import { awaitRoomDownSync } from "../../utils/RoomUpgrade";
import RoomViewStore from "../../stores/RoomViewStore";
import { ViewRoomPayload } from "../../dispatcher/payloads/ViewRoomPayload";
import { JoinRoomReadyPayload } from "../../dispatcher/payloads/JoinRoomReadyPayload";
interface IProps {
space: Room;
@ -339,7 +340,7 @@ export const showRoom = (cli: MatrixClient, hierarchy: RoomHierarchy, roomId: st
name: room.name || roomAlias || _t("Unnamed room"),
roomType,
} as IOOBData,
_trigger: "RoomDirectory",
metricsTrigger: "RoomDirectory",
});
};
@ -355,7 +356,13 @@ export const joinRoom = (cli: MatrixClient, hierarchy: RoomHierarchy, roomId: st
viaServers: Array.from(hierarchy.viaMap.get(roomId) || []),
});
prom.catch(err => {
prom.then(() => {
dis.dispatch<JoinRoomReadyPayload>({
action: Action.JoinRoomReady,
roomId,
metricsTrigger: "SpaceHierarchy",
});
}, err => {
RoomViewStore.showJoinRoomError(err, roomId);
});

View file

@ -867,7 +867,7 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
defaultDispatcher.dispatch<ViewRoomPayload>({
action: Action.ViewRoom,
room_id: this.state.firstRoomId,
_trigger: undefined, // other
metricsTrigger: undefined, // other
});
return;
}

View file

@ -202,7 +202,7 @@ export default class ThreadView extends React.Component<IProps, IState> {
event_id: this.props.initialEvent?.getId(),
highlighted: false,
replyingToEvent: this.state.replyToEvent,
_trigger: undefined, // room doesn't change
metricsTrigger: undefined, // room doesn't change
});
}
};

View file

@ -1195,7 +1195,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
dis.dispatch<ViewRoomPayload>({
action: Action.ViewRoom,
room_id: this.props.timelineSet.room.roomId,
_trigger: undefined, // room doesn't change
metricsTrigger: undefined, // room doesn't change
});
};
}