Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Update analytics for Composer events #11245

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/views/rooms/EditMessageComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
isEditing: true,
inThread: !!editedEvent?.getThread(),
isReply: !!editedEvent.replyEventId,
isLocation: false,
editor: "Legacy",
isMarkdownEnabled: SettingsStore.getValue("MessageComposerInput.useMarkdown"),
});

// Replace emoticon at the end of the message
Expand Down
3 changes: 3 additions & 0 deletions src/components/views/rooms/SendMessageComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
isEditing: false,
isReply: !!this.props.replyToEvent,
inThread: this.props.relation?.rel_type === THREAD_RELATION_TYPE.name,
isLocation: false,
editor: "Legacy",
isMarkdownEnabled: SettingsStore.getValue("MessageComposerInput.useMarkdown"),
};
if (posthogEvent.inThread && this.props.relation!.event_id) {
const threadRoot = this.props.room.findEventById(this.props.relation!.event_id);
Expand Down
14 changes: 9 additions & 5 deletions src/components/views/rooms/wysiwyg_composer/utils/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,16 @@ export async function sendMessage(
eventName: "Composer",
isEditing: false,
isReply: Boolean(replyToEvent),
// TODO thread
inThread: relation?.rel_type === THREAD_RELATION_TYPE.name,
isLocation: false,
editor: isHTML ? "RteFormatting" : "RtePlain",
isMarkdownEnabled: false,
};

// TODO thread
/*if (posthogEvent.inThread) {
const threadRoot = room.findEventById(relation?.event_id);
if (posthogEvent.inThread) {
const threadRoot = room.findEventById(relation?.event_id ?? "");
posthogEvent.startsThread = threadRoot?.getThread()?.events.length === 1;
}*/
}
PosthogAnalytics.instance.trackEvent<ComposerEvent>(posthogEvent);

let content: IContent | null = null;
Expand Down Expand Up @@ -201,6 +202,9 @@ export async function editMessage(
isEditing: true,
inThread: Boolean(editedEvent?.getThread()),
isReply: Boolean(editedEvent.replyEventId),
isLocation: false,
editor: "RteFormatting", // it is always the rich text mode when editing a message
isMarkdownEnabled: false,
});

// TODO emoji
Expand Down