use roomId as long as possible

This commit is contained in:
fkwp
2026-05-13 17:45:32 +02:00
parent 6c987eb0d4
commit be6e9110cb
4 changed files with 17 additions and 10 deletions

View File

@@ -17,6 +17,7 @@ import {
interface CallEnded extends IPosthogEvent {
eventName: "CallEnded";
// the callId posthog key is essentially a Matrix roomId
callId: string;
callParticipantsOnLeave: number;
callParticipantsMax: number;
@@ -120,6 +121,7 @@ export class CallEndedTracker {
interface CallStarted extends IPosthogEvent {
eventName: "CallStarted";
// the callId posthog key is essentially a Matrix roomId
callId: string;
}
@@ -180,6 +182,7 @@ export class LoginTracker {
interface MuteMicrophone {
eventName: "MuteMicrophone";
targetMuteState: "mute" | "unmute";
// the callId posthog key is essentially a Matrix roomId
callId: string;
}
@@ -196,6 +199,7 @@ export class MuteMicrophoneTracker {
interface MuteCamera {
eventName: "MuteCamera";
targetMuteState: "mute" | "unmute";
// the callId posthog key is essentially a Matrix roomId
callId: string;
}
@@ -211,6 +215,7 @@ export class MuteCameraTracker {
interface UndecryptableToDeviceEvent {
eventName: "UndecryptableToDeviceEvent";
// the callId posthog key is essentially a Matrix roomId
callId: string;
}
@@ -225,6 +230,7 @@ export class UndecryptableToDeviceEventTracker {
interface QualitySurveyEvent {
eventName: "QualitySurvey";
// the callId posthog key is essentially a Matrix roomId
callId: string;
feedbackText: string;
stars: number;
@@ -298,6 +304,7 @@ export type CallReconnectingReason =
interface CallReconnecting extends IPosthogEvent {
eventName: "CallReconnecting";
// the callId posthog key is essentially a Matrix roomId
callId: string;
reason: CallReconnectingReason;
reconnectDuration: number;

View File

@@ -560,7 +560,7 @@ export function createCallViewModel$(
connectionManager,
matrixRTCSession,
localTransport$,
callId: matrixRoom.roomId,
roomId: matrixRoom.roomId,
logger: logger.getChild(`[${Date.now()}]`),
});

View File

@@ -231,7 +231,7 @@ describe("LocalMembership", () => {
]),
rtsSession$: constant(RTCMemberStatus.Connected),
},
callId: "!test-room-id:example.org",
roomId: "!test-room-id:example.org",
};
it("throws error on missing RTC config error", () => {
@@ -772,7 +772,7 @@ describe("LocalMembership", () => {
hsReason$.next([true, null]);
expect(trackSpy).toHaveBeenCalledWith(
defaultCreateLocalMemberValues.callId,
defaultCreateLocalMemberValues.roomId,
"sync",
expect.any(Number),
);
@@ -822,7 +822,7 @@ describe("LocalMembership", () => {
connectionState$.next(ConnectionState.LivekitConnected);
expect(trackSpy).toHaveBeenCalledWith(
defaultCreateLocalMemberValues.callId,
defaultCreateLocalMemberValues.roomId,
"livekit",
expect.any(Number),
);
@@ -873,13 +873,13 @@ describe("LocalMembership", () => {
expect(trackSpy).toHaveBeenCalledTimes(2);
expect(trackSpy).toHaveBeenNthCalledWith(
1,
defaultCreateLocalMemberValues.callId,
defaultCreateLocalMemberValues.roomId,
"membership",
expect.any(Number),
);
expect(trackSpy).toHaveBeenNthCalledWith(
2,
defaultCreateLocalMemberValues.callId,
defaultCreateLocalMemberValues.roomId,
"probablyLeft",
expect.any(Number),
);

View File

@@ -128,7 +128,7 @@ interface Props {
createPublisherFactory: (connection: Connection) => Publisher;
joinMatrixRTC: (transport: LivekitTransportConfig) => void;
homeserverConnected: HomeserverConnected;
callId: string;
roomId: string;
localTransport$: Behavior<LocalTransport>;
matrixRTCSession: Pick<
MatrixRTCSession,
@@ -152,7 +152,7 @@ interface Props {
* @param props.logger The logger to use.
* @param props.muteStates The mute states for video and audio.
* @param props.matrixRTCSession The matrix RTC session to join.
* @param props.callId The room ID used as the call identifier in analytics events.
* @param props.roomId The room ID used as the call identifier in analytics events.
* @returns
* - publisher: The handle to create tracks and publish them to the room.
* - connected$: the current connection state. Including matrix server and livekit server connection. (only considering the livekit server we are using for our own media publication)
@@ -170,7 +170,7 @@ export const createLocalMembership$ = ({
logger: parentLogger,
muteStates,
matrixRTCSession,
callId,
roomId: roomId,
}: Props): {
/**
* This request to start audio and video tracks.
@@ -552,7 +552,7 @@ export const createLocalMembership$ = ({
}
} else if (reconnectStart !== null) {
PosthogAnalytics.instance.eventCallReconnecting.track(
callId,
roomId,
reconnectStart.reason,
(Date.now() - reconnectStart.time) / 1000,
);