:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(conversations): default outbound ticket sender to primary channel (#73434)
Luke Beltonec2002fd29cb
diff --git a/products/conversations/frontend/components/ComposeTicket/ComposeTicketModal.tsx b/products/conversations/frontend/components/ComposeTicket/ComposeTicketModal.tsxindex ca37d4058412..1b15b78e1e01 100644--- a/products/conversations/frontend/components/ComposeTicket/ComposeTicketModal.tsx+++ b/products/conversations/frontend/components/ComposeTicket/ComposeTicketModal.tsx@@ -1,7 +1,7 @@import { useActions, useValues } from 'kea'import { useRef } from 'react'-import { LemonButton, LemonInput, LemonModal, LemonSelect } from '@posthog/lemon-ui'+import { LemonButton, LemonInput, LemonModal, LemonSelect, LemonTag } from '@posthog/lemon-ui'import { RichContentEditorType } from 'lib/components/RichContentEditor/types'@@ -27,7 +27,12 @@ export function ComposeTicketModal(): JSX.Element | null {const emailConfigOptions = verifiedEmailConfigs.map((c) => ({value: c.id,- label: `${c.from_name} <${c.from_email}>`,+ label: (+ <span className="flex items-center gap-1">+ {`${c.from_name} <${c.from_email}>`}+ {c.is_default && <LemonTag type="primary">Primary</LemonTag>}+ </span>+ ),}))const handleSubmit = (): void => {diff --git a/products/conversations/frontend/components/ComposeTicket/composeTicketLogic.ts b/products/conversations/frontend/components/ComposeTicket/composeTicketLogic.tsindex 9b2656163fe9..35a5b465a05b 100644--- a/products/conversations/frontend/components/ComposeTicket/composeTicketLogic.ts+++ b/products/conversations/frontend/components/ComposeTicket/composeTicketLogic.ts@@ -19,6 +19,7 @@ export interface composeTicketLogicValues {isOpen: booleanrecipientDistinctId: stringrecipientEmail: string+ senderManuallySelected: boolean}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -52,8 +53,12 @@ export interface composeTicketLogicActions {resetForm: () => {value: true}- setEmailConfigId: (configId: string) => {+ setEmailConfigId: (+ configId: string,+ isManual?: boolean+ ) => {configId: string+ isManual: boolean}setEmailSubject: (subject: string) => {subject: string@@ -86,7 +91,7 @@ export const composeTicketLogic = kea<composeTicketLogicType>([setRecipientEmail: (email: string) => ({ email }),setRecipientDistinctId: (distinctId: string) => ({ distinctId }),setEmailSubject: (subject: string) => ({ subject }),- setEmailConfigId: (configId: string) => ({ configId }),+ setEmailConfigId: (configId: string, isManual: boolean = true) => ({ configId, isManual }),resetForm: true,submitCompose: (message: string, richContent: Record<string, unknown> | null) => ({ message, richContent }),submitComposeFinished: true,@@ -132,6 +137,14 @@ export const composeTicketLogic = kea<composeTicketLogicType>([resetForm: () => '',},],+ senderManuallySelected: [+ false,+ {+ setEmailConfigId: (_, { isManual }) => isManual,+ openComposeModal: () => false,+ resetForm: () => false,+ },+ ],composingLoading: [false,{@@ -168,6 +181,19 @@ export const composeTicketLogic = kea<composeTicketLogicType>([}actions.loadEmailConfigs()},+ loadEmailConfigsSuccess: ({ emailConfigs }) => {+ // Default the "From" address to the team's primary channel (falling back to the first verified one).+ // Skip only when the user picked a sender themselves — a newer response can still re-apply the default,+ // so a stale in-flight request can't lock in an outdated sender.+ if (values.senderManuallySelected) {+ return+ }+ const verified = emailConfigs.filter((c) => c.domain_verified)+ const defaultConfig = verified.find((c) => c.is_default) ?? verified[0]+ if (defaultConfig) {+ actions.setEmailConfigId(defaultConfig.id, false)+ }+ },submitCompose: async ({ message, richContent }) => {const { recipientEmail, recipientDistinctId, emailSubject, emailConfigId } = values