More posthog tracking around joining rooms and room search (#7807)
This commit is contained in:
parent
e997676ae2
commit
658590e5bc
59 changed files with 276 additions and 116 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
|
|||
event_id: this.props.mxEvent.getId(),
|
||||
highlighted: true,
|
||||
room_id: this.props.mxEvent.getRoomId(),
|
||||
_trigger: undefined, // room doesn't change
|
||||
metricsTrigger: undefined, // room doesn't change
|
||||
});
|
||||
this.closeMenu();
|
||||
};
|
||||
|
|
|
@ -253,8 +253,8 @@ const RoomContextMenu = ({ room, onFinished, ...props }: IProps) => {
|
|||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: room.roomId,
|
||||
_trigger: "RoomList",
|
||||
_viaKeyboard: ev.type !== "click",
|
||||
metricsTrigger: "RoomList",
|
||||
metricsViaKeyboard: ev.type !== "click",
|
||||
}, true);
|
||||
};
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ const SpaceContextMenu = ({ space, hideHeader, onFinished, ...props }: IProps) =
|
|||
action: Action.ViewRoom,
|
||||
room_id: space.roomId,
|
||||
forceTimeline: true,
|
||||
_trigger: undefined, // room doesn't change
|
||||
metricsTrigger: undefined, // room doesn't change
|
||||
});
|
||||
onFinished();
|
||||
};
|
||||
|
@ -197,7 +197,7 @@ const SpaceContextMenu = ({ space, hideHeader, onFinished, ...props }: IProps) =
|
|||
defaultDispatcher.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: space.roomId,
|
||||
_trigger: undefined, // other
|
||||
metricsTrigger: undefined, // other
|
||||
});
|
||||
onFinished();
|
||||
};
|
||||
|
|
|
@ -81,7 +81,7 @@ const ThreadListContextMenu: React.FC<IExtendedProps> = ({
|
|||
event_id: mxEvent.getId(),
|
||||
highlighted: true,
|
||||
room_id: mxEvent.getRoomId(),
|
||||
_trigger: undefined, // room doesn't change
|
||||
metricsTrigger: undefined, // room doesn't change
|
||||
});
|
||||
closeThreadOptions();
|
||||
}, [mxEvent, closeThreadOptions]);
|
||||
|
|
|
@ -104,7 +104,7 @@ export default class CreateCommunityPrototypeDialog extends React.PureComponent<
|
|||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: result.room_id,
|
||||
_trigger: undefined, // Deprecated groups
|
||||
metricsTrigger: undefined, // Deprecated groups
|
||||
});
|
||||
showCommunityRoomInviteDialog(result.room_id, this.state.name);
|
||||
} else {
|
||||
|
|
|
@ -230,7 +230,7 @@ const CreateSpaceFromCommunityDialog: React.FC<IProps> = ({ matrixClient: cli, g
|
|||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: roomId,
|
||||
_trigger: undefined, // other
|
||||
metricsTrigger: undefined, // other
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -81,8 +81,8 @@ const Entry: React.FC<IEntryProps> = ({ room, event, matrixClient: cli, onFinish
|
|||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: room.roomId,
|
||||
_trigger: "WebForwardShortcut",
|
||||
_viaKeyboard: ev.type !== "click",
|
||||
metricsTrigger: "WebForwardShortcut",
|
||||
metricsViaKeyboard: ev.type !== "click",
|
||||
});
|
||||
onFinished(true);
|
||||
};
|
||||
|
|
|
@ -682,7 +682,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
|||
room_id: existingRoom.roomId,
|
||||
should_peek: false,
|
||||
joining: false,
|
||||
_trigger: "MessageUser",
|
||||
metricsTrigger: "MessageUser",
|
||||
});
|
||||
this.props.onFinished(true);
|
||||
return;
|
||||
|
|
|
@ -94,6 +94,7 @@ export default class RoomSettingsDialog extends React.Component<IProps, IState>
|
|||
_td("General"),
|
||||
"mx_RoomSettingsDialog_settingsIcon",
|
||||
<GeneralRoomSettingsTab roomId={this.props.roomId} />,
|
||||
"RoomSettingsGeneral",
|
||||
));
|
||||
tabs.push(new Tab(
|
||||
ROOM_SECURITY_TAB,
|
||||
|
@ -103,18 +104,21 @@ export default class RoomSettingsDialog extends React.Component<IProps, IState>
|
|||
roomId={this.props.roomId}
|
||||
closeSettingsFn={() => this.props.onFinished(true)}
|
||||
/>,
|
||||
"RoomSettingsSecurityPrivacy",
|
||||
));
|
||||
tabs.push(new Tab(
|
||||
ROOM_ROLES_TAB,
|
||||
_td("Roles & Permissions"),
|
||||
"mx_RoomSettingsDialog_rolesIcon",
|
||||
<RolesRoomSettingsTab roomId={this.props.roomId} />,
|
||||
"RoomSettingsRolesPermissions",
|
||||
));
|
||||
tabs.push(new Tab(
|
||||
ROOM_NOTIFICATIONS_TAB,
|
||||
_td("Notifications"),
|
||||
"mx_RoomSettingsDialog_notificationsIcon",
|
||||
<NotificationSettingsTab roomId={this.props.roomId} closeSettingsFn={() => this.props.onFinished(true)} />,
|
||||
"RoomSettingsNotifications",
|
||||
));
|
||||
|
||||
if (SettingsStore.getValue("feature_bridge_state")) {
|
||||
|
@ -123,6 +127,7 @@ export default class RoomSettingsDialog extends React.Component<IProps, IState>
|
|||
_td("Bridges"),
|
||||
"mx_RoomSettingsDialog_bridgesIcon",
|
||||
<BridgeSettingsTab roomId={this.props.roomId} />,
|
||||
"RoomSettingsBridges",
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -135,6 +140,7 @@ export default class RoomSettingsDialog extends React.Component<IProps, IState>
|
|||
roomId={this.props.roomId}
|
||||
closeSettingsFn={() => this.props.onFinished(true)}
|
||||
/>,
|
||||
"RoomSettingsAdvanced",
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import { normalize } from "matrix-js-sdk/src/utils";
|
|||
import { IHierarchyRoom } from "matrix-js-sdk/src/@types/spaces";
|
||||
import { RoomHierarchy } from "matrix-js-sdk/src/room-hierarchy";
|
||||
import { RoomType } from "matrix-js-sdk/src/@types/event";
|
||||
import { WebSearch as WebSearchEvent } from "matrix-analytics-events/types/typescript/WebSearch";
|
||||
|
||||
import { IDialogProps } from "./IDialogProps";
|
||||
import { _t } from "../../../languageHandler";
|
||||
|
@ -72,6 +73,7 @@ import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload";
|
|||
import { getMetaSpaceName } from "../../../stores/spaces";
|
||||
import { getKeyBindingsManager } from "../../../KeyBindingsManager";
|
||||
import { KeyBindingAction } from "../../../accessibility/KeyboardShortcuts";
|
||||
import { PosthogAnalytics } from "../../../PosthogAnalytics";
|
||||
import { getCachedRoomIDForAlias } from "../../../RoomAliasCache";
|
||||
|
||||
const MAX_RECENT_SEARCHES = 10;
|
||||
|
@ -205,6 +207,26 @@ type Result = IRoomResult | IResult;
|
|||
|
||||
const isRoomResult = (result: any): result is IRoomResult => !!result?.room;
|
||||
|
||||
export const useWebSearchMetrics = (numResults: number, queryLength: number, viaSpotlight: boolean): void => {
|
||||
useEffect(() => {
|
||||
if (!queryLength) return;
|
||||
|
||||
// send metrics after a 1s debounce
|
||||
const timeoutId = setTimeout(() => {
|
||||
PosthogAnalytics.instance.trackEvent<WebSearchEvent>({
|
||||
eventName: "WebSearch",
|
||||
viaSpotlight,
|
||||
numResults,
|
||||
queryLength,
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
return () => {
|
||||
clearTimeout(timeoutId);
|
||||
};
|
||||
}, [numResults, queryLength, viaSpotlight]);
|
||||
};
|
||||
|
||||
const SpotlightDialog: React.FC<IProps> = ({ initialText = "", onFinished }) => {
|
||||
const cli = MatrixClientPeg.get();
|
||||
const rovingContext = useContext(RovingTabIndexContext);
|
||||
|
@ -270,6 +292,9 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", onFinished }) =>
|
|||
return results;
|
||||
}, [possibleResults, trimmedQuery]);
|
||||
|
||||
const numResults = trimmedQuery ? people.length + rooms.length + spaces.length : 0;
|
||||
useWebSearchMetrics(numResults, query.length, true);
|
||||
|
||||
const activeSpace = SpaceStore.instance.activeSpaceRoom;
|
||||
const [spaceResults, spaceResultsLoading] = useSpaceResults(activeSpace, query);
|
||||
|
||||
|
@ -310,8 +335,8 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", onFinished }) =>
|
|||
defaultDispatcher.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: roomId,
|
||||
_trigger: "WebUnifiedSearch",
|
||||
_viaKeyboard: viaKeyboard,
|
||||
metricsTrigger: "WebUnifiedSearch",
|
||||
metricsViaKeyboard: viaKeyboard,
|
||||
});
|
||||
onFinished();
|
||||
};
|
||||
|
@ -429,8 +454,8 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", onFinished }) =>
|
|||
action: Action.ViewRoom,
|
||||
room_alias: trimmedQuery,
|
||||
auto_join: true,
|
||||
_trigger: "WebUnifiedSearch",
|
||||
_viaKeyboard: ev.type !== "click",
|
||||
metricsTrigger: "WebUnifiedSearch",
|
||||
metricsViaKeyboard: ev.type !== "click",
|
||||
});
|
||||
onFinished();
|
||||
}}
|
||||
|
@ -670,6 +695,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", onFinished }) =>
|
|||
onFinished={onFinished}
|
||||
hasCancel={false}
|
||||
onKeyDown={onDialogKeyDown}
|
||||
screenName="UnifiedSearch"
|
||||
>
|
||||
<div className="mx_SpotlightDialog_searchBox mx_textinput">
|
||||
<input
|
||||
|
|
|
@ -199,7 +199,11 @@ export default class UserSettingsDialog extends React.Component<IProps, IState>
|
|||
title={_t("Settings")}
|
||||
>
|
||||
<div className='mx_SettingsDialog_content'>
|
||||
<TabbedView tabs={this.getTabs()} initialTabId={this.props.initialTabId} />
|
||||
<TabbedView
|
||||
tabs={this.getTabs()}
|
||||
initialTabId={this.props.initialTabId}
|
||||
screenName="UserSettings"
|
||||
/>
|
||||
</div>
|
||||
</BaseDialog>
|
||||
);
|
||||
|
|
|
@ -339,7 +339,7 @@ export default class ImageView extends React.Component<IProps, IState> {
|
|||
event_id: this.props.mxEvent.getId(),
|
||||
highlighted: true,
|
||||
room_id: this.props.mxEvent.getRoomId(),
|
||||
_trigger: undefined, // room doesn't change
|
||||
metricsTrigger: undefined, // room doesn't change
|
||||
});
|
||||
this.props.onFinished();
|
||||
};
|
||||
|
|
|
@ -147,7 +147,7 @@ export default class DateSeparator extends React.Component<IProps, IState> {
|
|||
event_id: eventId,
|
||||
highlighted: true,
|
||||
room_id: roomId,
|
||||
_trigger: undefined, // room doesn't change
|
||||
metricsTrigger: undefined, // room doesn't change
|
||||
});
|
||||
} catch (e) {
|
||||
const code = e.errcode || e.statusCode;
|
||||
|
|
|
@ -45,8 +45,8 @@ export default class RoomCreate extends React.Component<IProps> {
|
|||
event_id: predecessor['event_id'],
|
||||
highlighted: true,
|
||||
room_id: predecessor['room_id'],
|
||||
_trigger: "Predecessor",
|
||||
_viaKeyboard: e.type !== "click",
|
||||
metricsTrigger: "Predecessor",
|
||||
metricsViaKeyboard: e.type !== "click",
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ export default class TimelineCard extends React.Component<IProps, IState> {
|
|||
event_id: this.state.initialEventId,
|
||||
highlighted: false,
|
||||
replyingToEvent: this.state.replyToEvent,
|
||||
_trigger: undefined, // room doesn't change
|
||||
metricsTrigger: undefined, // room doesn't change
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -131,8 +131,8 @@ async function openDMForUser(matrixClient: MatrixClient, userId: string, viaKeyb
|
|||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: lastActiveRoom.roomId,
|
||||
_trigger: "MessageUser",
|
||||
_viaKeyboard: viaKeyboard,
|
||||
metricsTrigger: "MessageUser",
|
||||
metricsViaKeyboard: viaKeyboard,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ const UserOptionsSection: React.FC<{
|
|||
highlighted: true,
|
||||
event_id: room.getEventReadUpTo(member.userId),
|
||||
room_id: member.roomId,
|
||||
_trigger: undefined, // room doesn't change
|
||||
metricsTrigger: undefined, // room doesn't change
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -720,7 +720,7 @@ export default class EventTile extends React.Component<IProps, IState> {
|
|||
event_id: this.props.mxEvent.getId(),
|
||||
highlighted: true,
|
||||
room_id: this.props.mxEvent.getRoomId(),
|
||||
_trigger: undefined, // room doesn't change
|
||||
metricsTrigger: undefined, // room doesn't change
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -1023,7 +1023,9 @@ export default class EventTile extends React.Component<IProps, IState> {
|
|||
event_id: this.props.mxEvent.getId(),
|
||||
highlighted: true,
|
||||
room_id: this.props.mxEvent.getRoomId(),
|
||||
_trigger: this.props.timelineRenderingType === TimelineRenderingType.Search ? "MessageSearch" : undefined,
|
||||
metricsTrigger: this.props.timelineRenderingType === TimelineRenderingType.Search
|
||||
? "MessageSearch"
|
||||
: undefined,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -237,8 +237,8 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
|||
// Try to join via the server that sent the event. This converts @something:example.org
|
||||
// into a server domain by splitting on colons and ignoring the first entry ("@something").
|
||||
via_servers: viaServers,
|
||||
_trigger: "Tombstone",
|
||||
_viaKeyboard: ev.type !== "click",
|
||||
metricsTrigger: "Tombstone",
|
||||
metricsViaKeyboard: ev.type !== "click",
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ export default class PinnedEventTile extends React.Component<IProps> {
|
|||
event_id: this.props.event.getId(),
|
||||
highlighted: true,
|
||||
room_id: this.props.event.getRoomId(),
|
||||
_trigger: undefined, // room doesn't change
|
||||
metricsTrigger: undefined, // room doesn't change
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ const RecentlyViewedButton = () => {
|
|||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: crumb.roomId,
|
||||
_trigger: "WebVerticalBreadcrumbs",
|
||||
_viaKeyboard: ev.type !== "click",
|
||||
metricsTrigger: "WebVerticalBreadcrumbs",
|
||||
metricsViaKeyboard: ev.type !== "click",
|
||||
});
|
||||
tooltipRef.current?.hideTooltip();
|
||||
}}
|
||||
|
|
|
@ -100,7 +100,7 @@ export default class ReplyTile extends React.PureComponent<IProps> {
|
|||
event_id: this.props.mxEvent.getId(),
|
||||
highlighted: true,
|
||||
room_id: this.props.mxEvent.getRoomId(),
|
||||
_trigger: undefined, // room doesn't change
|
||||
metricsTrigger: undefined, // room doesn't change
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,8 +110,8 @@ export default class RoomBreadcrumbs extends React.PureComponent<IProps, IState>
|
|||
defaultDispatcher.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: room.roomId,
|
||||
_trigger: "WebHorizontalBreadcrumbs",
|
||||
_viaKeyboard: viaKeyboard,
|
||||
metricsTrigger: "WebHorizontalBreadcrumbs",
|
||||
metricsViaKeyboard: viaKeyboard,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ export default class RoomDetailList extends React.Component<IProps> {
|
|||
action: Action.ViewRoom,
|
||||
room_id: room.roomId,
|
||||
room_alias: room.getCanonicalAlias() || (room.getAltAliases() || [])[0],
|
||||
_trigger: undefined, // Deprecated groups
|
||||
metricsTrigger: undefined, // Deprecated groups
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ const UntaggedAuxButton = ({ tabIndex }: IAuxButtonProps) => {
|
|||
defaultDispatcher.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: activeSpace.roomId,
|
||||
_trigger: undefined, // other
|
||||
metricsTrigger: undefined, // other
|
||||
});
|
||||
PosthogTrackers.trackInteraction("WebRoomListRoomsSublistPlusMenuExploreRoomsItem", e);
|
||||
}}
|
||||
|
@ -424,8 +424,8 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
|||
action: Action.ViewRoom,
|
||||
room_id: room.roomId,
|
||||
show_room_tile: true, // to make sure the room gets scrolled into view
|
||||
_trigger: "WebKeyboardShortcut",
|
||||
_viaKeyboard: true,
|
||||
metricsTrigger: "WebKeyboardShortcut",
|
||||
metricsViaKeyboard: true,
|
||||
});
|
||||
}
|
||||
} else if (payload.action === Action.PstnSupportUpdated) {
|
||||
|
@ -509,7 +509,7 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
|||
defaultDispatcher.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: this.props.activeSpace,
|
||||
_trigger: undefined, // other
|
||||
metricsTrigger: undefined, // other
|
||||
});
|
||||
PosthogTrackers.trackInteraction("WebRoomListRoomsSublistPlusMenuExploreRoomsItem", ev);
|
||||
} else {
|
||||
|
@ -542,8 +542,8 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
|||
avatarUrl: room.avatar_url,
|
||||
name,
|
||||
},
|
||||
_trigger: "RoomList",
|
||||
_viaKeyboard: ev.type !== "click",
|
||||
metricsTrigger: "RoomList",
|
||||
metricsViaKeyboard: ev.type !== "click",
|
||||
});
|
||||
};
|
||||
return (
|
||||
|
|
|
@ -61,6 +61,7 @@ import TooltipTarget from "../elements/TooltipTarget";
|
|||
import { BetaPill } from "../beta/BetaCard";
|
||||
import PosthogTrackers from "../../../PosthogTrackers";
|
||||
import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload";
|
||||
import { useWebSearchMetrics } from "../dialogs/SpotlightDialog";
|
||||
|
||||
const contextMenuBelow = (elementRect: DOMRect) => {
|
||||
// align the context menu's icons with the icon which opened the context menu
|
||||
|
@ -108,7 +109,7 @@ const PrototypeCommunityContextMenu = (props: ComponentProps<typeof SpaceContext
|
|||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: chat.roomId,
|
||||
_trigger: undefined, // Deprecated groups
|
||||
metricsTrigger: undefined, // Deprecated groups
|
||||
}, true);
|
||||
RightPanelStore.instance.setCard({ phase: RightPanelPhases.RoomMemberList }, undefined, chat.roomId);
|
||||
} else {
|
||||
|
@ -177,14 +178,18 @@ const RoomListHeader = ({ spacePanelDisabled, onVisibilityChange }: IProps) => {
|
|||
});
|
||||
const joiningRooms = useJoiningRooms();
|
||||
|
||||
const filterCondition = RoomListStore.instance.getFirstNameFilterCondition();
|
||||
const count = useEventEmitterState(RoomListStore.instance, LISTS_UPDATE_EVENT, () => {
|
||||
if (RoomListStore.instance.getFirstNameFilterCondition()) {
|
||||
if (filterCondition) {
|
||||
return Object.values(RoomListStore.instance.orderedLists).flat(1).length;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// we pass null for the queryLength to inhibit the metrics hook for when there is no filterCondition
|
||||
useWebSearchMetrics(count, filterCondition ? filterCondition.search.length : null, false);
|
||||
|
||||
const spaceName = useEventEmitterState(activeSpace, "Room.name", () => activeSpace?.name);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -279,7 +284,7 @@ const RoomListHeader = ({ spacePanelDisabled, onVisibilityChange }: IProps) => {
|
|||
defaultDispatcher.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: activeSpace.roomId,
|
||||
_trigger: undefined, // other
|
||||
metricsTrigger: undefined, // other
|
||||
});
|
||||
closePlusMenu();
|
||||
PosthogTrackers.trackInteraction("WebRoomListHeaderPlusMenuExploreRoomsItem", e);
|
||||
|
|
|
@ -433,8 +433,8 @@ export default class RoomSublist extends React.Component<IProps, IState> {
|
|||
action: Action.ViewRoom,
|
||||
room_id: room.roomId,
|
||||
show_room_tile: true, // to make sure the room gets scrolled into view
|
||||
_trigger: "WebRoomListNotificationBadge",
|
||||
_viaKeyboard: ev.type !== "click",
|
||||
metricsTrigger: "WebRoomListNotificationBadge",
|
||||
metricsViaKeyboard: ev.type !== "click",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -245,8 +245,8 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
|
|||
show_room_tile: true, // make sure the room is visible in the list
|
||||
room_id: this.props.room.roomId,
|
||||
clear_search: (ev && (ev.key === Key.ENTER || ev.key === Key.SPACE)),
|
||||
_trigger: "RoomList",
|
||||
_viaKeyboard: ev.type !== "click",
|
||||
metricsTrigger: "RoomList",
|
||||
metricsViaKeyboard: ev.type !== "click",
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -271,7 +271,7 @@ const JoinRuleSettings = ({ room, promptUpgrade, aliasWarning, onError, beforeCh
|
|||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: roomId,
|
||||
_trigger: undefined, // other
|
||||
metricsTrigger: undefined, // other
|
||||
});
|
||||
|
||||
// open new settings on this tab
|
||||
|
|
|
@ -95,8 +95,8 @@ export default class AdvancedRoomSettingsTab extends React.Component<IProps, ISt
|
|||
action: Action.ViewRoom,
|
||||
room_id: this.state.oldRoomId,
|
||||
event_id: this.state.oldEventId,
|
||||
_trigger: "WebPredecessorSettings",
|
||||
_viaKeyboard: e.type !== "click",
|
||||
metricsTrigger: "WebPredecessorSettings",
|
||||
metricsViaKeyboard: e.type !== "click",
|
||||
});
|
||||
this.props.closeSettingsFn();
|
||||
};
|
||||
|
|
|
@ -117,7 +117,7 @@ const CommunityMigrator = ({ onFinished }) => {
|
|||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: community.spaceId,
|
||||
_trigger: undefined, // other
|
||||
metricsTrigger: undefined, // other
|
||||
});
|
||||
onFinished();
|
||||
} else {
|
||||
|
|
|
@ -115,7 +115,7 @@ export default class VerificationRequestToast extends React.PureComponent<IProps
|
|||
action: Action.ViewRoom,
|
||||
room_id: request.channel.roomId,
|
||||
should_peek: false,
|
||||
_trigger: "VerificationRequest",
|
||||
metricsTrigger: "VerificationRequest",
|
||||
});
|
||||
const member = cli.getUser(request.otherUserId);
|
||||
RightPanelStore.instance.setCards(
|
||||
|
|
|
@ -41,7 +41,7 @@ const onExpandClick = (roomId: string) => {
|
|||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: roomId,
|
||||
_trigger: "WebFloatingCallWindow",
|
||||
metricsTrigger: "WebFloatingCallWindow",
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ export default class PipView extends React.Component<IProps, IState> {
|
|||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: callRoomId ?? widgetRoomId,
|
||||
_trigger: "WebFloatingCallWindow",
|
||||
metricsTrigger: "WebFloatingCallWindow",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue