Skip to content

: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.

feat(customer-analytics): show only the next occurrence of recurring meetings (#111117)

Arthur Moreira de Deusc1af81846d97
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 11ad836afe3b..1ad119cbaa24 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -8986,6 +8986,14 @@ snapshots:
hash: v1.k794b7964.26a93f54f5fe293e17ee0f7315163a5b14c71e1e78e1bb8adc78f09ca04412f3.4gU8PFyIaVQrS8zOPX6Al_eLweeNi9XIAQ9hfr2pzag
scenes-app-customer-analytics-account-detail--external-id--light:
hash: v1.k794b7964.ba37b8bdfb72378768cbb9461ca2572f535c959b4c506b23329c5b3d310c77c6.KGICYox6wm5BBVgvW2c5GXZfbOf9S5QScOhY9rSEFWI
+ scenes-app-customer-analytics-account-detail--meetings--dark:
+ hash: v1.k794b7964.e62fc1eecd1da5d38cea9fe2df12369519a953dcd2cc087f64cd83148daf1651.89zoE2mxzfl6Xz8L3IRBs9P25XlAiI2LPYbbA3Dz9uw
+ scenes-app-customer-analytics-account-detail--meetings--light:
+ hash: v1.k794b7964.07e76ca1b000e109986d83f3527e55f644a99051aedd27510ce4497413149293.eI8xnDMzYD1OojNGnUTw6xpQOGDdUEjXh4t9QskgsXQ
+ scenes-app-customer-analytics-account-detail--meetings-narrow--dark:
+ hash: v1.k794b7964.649dce4fa92355eb25e7c53fbfbef590c003a4ebb6459d52fd79637b57186785.KS9yifiPkGmJWpATN-Qz7-bUy1-jyJZLp2g-UFFutXc
+ scenes-app-customer-analytics-account-detail--meetings-narrow--light:
+ hash: v1.k794b7964.d71834e0278d00db1dd2937f1530759a11ab284affe7f1d89491e75397f6f07f.i04wuQH_Tmk5BM4wACjCoy7rlcIHPSrwE415oZV38i0
scenes-app-customer-analytics-account-detail--narrow--dark:
hash: v1.k794b7964.acb3423c3a688e82a8d3304f52abc9ec9fe1bb85b498b2a5014c2a2e95b9d877.O3Dc_DGbMRxU8xAvLVsLhmaDF30FZT7vFNKa5dkYlq0
scenes-app-customer-analytics-account-detail--narrow--light:
diff --git a/products/customer_analytics/backend/facade/api.py b/products/customer_analytics/backend/facade/api.py
index 46226970a41a..ae2f01cdaffe 100644
--- a/products/customer_analytics/backend/facade/api.py
+++ b/products/customer_analytics/backend/facade/api.py
@@ -165,6 +165,7 @@ from products.customer_analytics.backend.models import (
EventStream,
EventStreamMember,
Meeting,
+ MeetingStatus,
SyncStatus,
SyncTrigger,
TargetType,
@@ -4677,11 +4678,24 @@ def list_account_meetings(
search: str | None = None,
) -> tuple[list[contracts.MeetingView], int] | None:
"""Synced calendar meetings for an accessible account, newest first, optionally
- filtered by ``search`` (title or attendee email/name). None when the account isn't
+ filtered by ``search`` (title or attendee email/name). A recurring series shows each
+ past occurrence but only its next upcoming one. None when the account isn't
accessible (→ 404)."""
if get_accessible_account_id(team_id, account_id, user_access_control) is None:
return None
- queryset = Meeting.objects.for_team(team_id).filter(account_id=account_id)
+ now = timezone.now()
+ next_occurrence_id = (
+ Meeting.objects.for_team(team_id)
+ .filter(account_id=account_id, ical_uid=OuterRef("ical_uid"), start_time__gte=now)
+ .exclude(recurrence_instance_id="")
+ .exclude(status=MeetingStatus.CANCELLED)
+ .order_by("start_time")
+ .values("id")[:1]
+ )
+ queryset = Meeting.objects.for_team(team_id).filter(
+ Q(recurrence_instance_id="") | Q(start_time__lt=now) | Q(id=Subquery(next_occurrence_id)),
+ account_id=account_id,
+ )
if search:
queryset = queryset.filter(
Q(title__icontains=search)
@@ -4704,6 +4718,7 @@ def list_account_meetings(
contracts.MeetingView(
id=meeting.id,
title=meeting.title,
+ is_recurring=bool(meeting.recurrence_instance_id),
gong_url=gong_urls_by_meeting_id.get(meeting.id),
start_time=meeting.start_time,
end_time=meeting.end_time,
diff --git a/products/customer_analytics/backend/facade/contracts.py b/products/customer_analytics/backend/facade/contracts.py
index 021c7542b4d2..8aeb90023847 100644
--- a/products/customer_analytics/backend/facade/contracts.py
+++ b/products/customer_analytics/backend/facade/contracts.py
@@ -227,6 +227,7 @@ class MeetingView:
id: UUID
title: str
+ is_recurring: bool
gong_url: str | None
start_time: datetime
end_time: datetime | None
diff --git a/products/customer_analytics/backend/presentation/views/serializers.py b/products/customer_analytics/backend/presentation/views/serializers.py
index ba2df42c2355..7762b694ab6e 100644
--- a/products/customer_analytics/backend/presentation/views/serializers.py
+++ b/products/customer_analytics/backend/presentation/views/serializers.py
@@ -1668,6 +1668,13 @@ class MeetingSerializer(DataclassSerializer):
id = serializers.UUIDField(read_only=True, help_text="UUID of the meeting.")
title = serializers.CharField(read_only=True, allow_blank=True, help_text="Meeting title; may be empty.")
+ is_recurring = serializers.BooleanField(
+ read_only=True,
+ help_text=(
+ "Whether the meeting belongs to a recurring series. Account meeting lists include all past occurrences "
+ "and only the next upcoming, non-canceled occurrence of each series."
+ ),
+ )
gong_url = serializers.URLField(
read_only=True,
allow_null=True,
@@ -1686,7 +1693,17 @@ class MeetingSerializer(DataclassSerializer):
class Meta:
dataclass = MeetingView
ref_name = "Meeting"
- fields = ["id", "title", "gong_url", "start_time", "end_time", "organizer_email", "status", "participants"]
+ fields = [
+ "id",
+ "title",
+ "is_recurring",
+ "gong_url",
+ "start_time",
+ "end_time",
+ "organizer_email",
+ "status",
+ "participants",
+ ]
class CustomPropertyReferenceSerializer(DataclassSerializer):
diff --git a/products/customer_analytics/backend/test/test_views.py b/products/customer_analytics/backend/test/test_views.py
index cc31293e65bc..8ae3b294d9a1 100644
--- a/products/customer_analytics/backend/test/test_views.py
+++ b/products/customer_analytics/backend/test/test_views.py
@@ -3916,6 +3916,43 @@ class TestAccountMeetingViewSet(APIBaseTest):
self.assertEqual(response.json()["results"][0]["id"], str(meeting.id))
self.assertEqual(response.json()["results"][0]["gong_url"], "https://app.gong.io/call?id=123")
+ @time_machine.travel("2026-08-10T12:00:00Z", tick=False)
+ def test_list_collapses_upcoming_occurrences_of_a_recurring_series(self):
+ account = Account.objects.unscoped().create(team=self.team, name="Acme Corp", external_id="acme-recurring")
+
+ def occurrence(start: str, status: str = "confirmed") -> Meeting:
+ return Meeting.objects.unscoped().create(
+ team=self.team,
+ account=account,
+ ical_uid="uid-weekly",
+ recurrence_instance_id=start,
+ start_time=start,
+ status=status,
+ title="Weekly sync",
+ )
+
+ past_1 = occurrence("2026-08-03T15:00:00Z")
+ past_2 = occurrence("2026-08-06T15:00:00Z")
+ occurrence("2026-08-13T15:00:00Z", status="cancelled")
+ next_up = occurrence("2026-08-20T15:00:00Z")
+ occurrence("2026-08-27T15:00:00Z")
+ one_off = Meeting.objects.unscoped().create(
+ team=self.team, account=account, ical_uid="uid-one-off", start_time="2026-09-01T15:00:00Z"
+ )
+
+ payload = self.client.get(f"/api/environments/{self.team.id}/accounts/{account.id}/meetings/").json()
+
+ self.assertEqual(payload["count"], 4)
+ self.assertEqual(
+ [(m["id"], m["is_recurring"]) for m in payload["results"]],
+ [
+ (str(one_off.id), False),
+ (str(next_up.id), True),
+ (str(past_2.id), True),
+ (str(past_1.id), True),
+ ],
+ )
+
def test_search_filters_by_title_or_attendee(self):
account = Account.objects.unscoped().create(team=self.team, name="Acme Corp", external_id="acme-2")
review = Meeting.objects.unscoped().create(
diff --git a/products/customer_analytics/frontend/components/Accounts/AGENTS.md b/products/customer_analytics/frontend/components/Accounts/AGENTS.md
index 16a4227da8f7..96060e2817f5 100644
--- a/products/customer_analytics/frontend/components/Accounts/AGENTS.md
+++ b/products/customer_analytics/frontend/components/Accounts/AGENTS.md
@@ -240,7 +240,7 @@ The Email threads tab lists matched customer communication from Conversations. `
Conversations stores synced email and Support message bodies as Markdown, with recovered links folded in as `[label](url)` or `<url>`. `ConversationMessageContent` renders them with `LemonMarkdown` and passes `disableImages="all"` and `disableMentions`, because external senders write this content. It must not load any image, including PostHog-hosted URLs that could act as tracking pixels, or render member mention chips. Row previews stay plain text: `markdownLinksToText` keeps each link's label and drops its URL.
-The Meetings tab (flag-gated, `CUSTOMER_ANALYTICS_CSP`) lists the account's synced Google Calendar meetings from the `accounts/:id/meetings` endpoint. The calendar-sync Temporal workflow (`backend/logic/calendar_sync.py`) writes rows from calendars connected in Customer analytics settings and attaches them to an account through known emails, person resolution, and email domains. For each response page, the endpoint checks queryable `calls` tables from synced Gong sources. It joins `calendar_event_id` to the meeting's `ical_uid`, with `_<recurrence_instance_id>` appended for recurring meetings. A matching HTTPS `gong.io` URL appears as an "Open in Gong" button after the meeting name. The optional lookup respects the viewer's warehouse access and does not fail the meetings response when Gong data is unavailable.
+The Meetings tab (flag-gated, `CUSTOMER_ANALYTICS_CSP`) lists the account's synced Google Calendar meetings from the `accounts/:id/meetings` endpoint. The calendar-sync Temporal workflow (`backend/logic/calendar_sync.py`) writes rows from calendars connected in Customer analytics settings and attaches them to an account through known emails, person resolution, and email domains. A recurring series is listed with every past occurrence but only its next upcoming, non-cancelled occurrence; the endpoint marks recurring rows with `is_recurring`, and the When cell shows "Recurring" inline with the upcoming occurrence's date. For each response page, the endpoint checks queryable `calls` tables from synced Gong sources. It joins `calendar_event_id` to the meeting's `ical_uid`, with `_<recurrence_instance_id>` appended for recurring meetings. A matching HTTPS `gong.io` URL appears as an "Open in Gong" button after the meeting name. The optional lookup respects the viewer's warehouse access and does not fail the meetings response when Gong data is unavailable.
`accountMeetingsLogic` owns three states like the Support tickets tab (skeleton on first load / load-failed / "no meetings yet"), plus **server-side pagination and search** (like the Users tab: `page` + `searchTerm` feed the endpoint's `limit`/`offset`/`search` params; search debounces, resets to page 1, and fires `MeetingsSearched`), the **attendee cell** state (first 3 attendees shown, "+N more"/"show less" toggles `expandedAttendeeMeetingIds`; attendees with a resolved `person_id` — populated by the sync via the same HogQL person-email lookup the account matching uses — get a leading `ProfilePicture` (xs, gravatar-by-email) and link to their person page, firing `MeetingAttendeeClicked`; each attendee carries a minimal RSVP glyph after the name — green check accepted, red x declined, muted "?" tentative, nothing for needs_action), and the project-admin-gated **"Edit matching" inline panel**: two `LemonInputSelect` chip inputs editing the account's `email_domains` and `known_emails` properties (normalized, merged into `properties` via `accountsPartialUpdate`, propagated through `accountLinksLogic.loadAccountSuccess`).
The matching editor is deliberately an inline panel above the table, not a dropdown — the `LemonInputSelect` suggestion popover opens below the inputs and would cover Save/Cancel inside a small overlay, so the buttons sit beside the inputs instead.
Saving fires `MeetingMatchingSaved`. Expanding the matching rules enqueues a post-commit task that applies them to unassigned stored meetings without overwriting existing account assignments.
diff --git a/products/customer_analytics/frontend/components/Accounts/AccountMeetingsExpansion.test.tsx b/products/customer_analytics/frontend/components/Accounts/AccountMeetingsExpansion.test.tsx
index 54a148d772f7..ed30c2329c9d 100644
--- a/products/customer_analytics/frontend/components/Accounts/AccountMeetingsExpansion.test.tsx
+++ b/products/customer_analytics/frontend/components/Accounts/AccountMeetingsExpansion.test.tsx
@@ -30,6 +30,7 @@ class ResizeObserverMock {
const meeting: MeetingApi = {
id: 'meeting-1',
title: 'Quarterly review',
+ is_recurring: false,
gong_url: 'https://app.gong.io/call?id=123',
start_time: '2026-08-03T15:00:00Z',
end_time: '2026-08-03T15:30:00Z',
@@ -54,6 +55,31 @@ describe('AccountMeetingsExpansion', () => {
afterEach(() => {
cleanup()
+ jest.useRealTimers()
+ })
+
+ test.each([
+ { kind: 'future recurring', startTime: '2026-08-04T15:00:00Z', isRecurring: true, badgeCount: 1 },
+ { kind: 'past recurring', startTime: '2026-08-02T15:00:00Z', isRecurring: true, badgeCount: 0 },
+ { kind: 'future one-off', startTime: '2026-08-04T15:00:00Z', isRecurring: false, badgeCount: 0 },
+ ])('renders the recurring badge correctly for a $kind meeting', async ({ startTime, isRecurring, badgeCount }) => {
+ jest.useFakeTimers()
+ jest.setSystemTime(new Date('2026-08-03T12:00:00Z'))
+ mockList.mockResolvedValue({
+ count: 1,
+ next: null,
+ previous: null,
+ results: [{ ...meeting, start_time: startTime, is_recurring: isRecurring }],
+ })
+
+ render(
+ <Provider>
+ <AccountMeetingsExpansion accountId="account-1" />
+ </Provider>
+ )
+
+ expect(await screen.findByText(meeting.title)).toBeInTheDocument()
+ expect(screen.queryAllByText('Recurring')).toHaveLength(badgeCount)
})
it('opens a matched meeting in Gong', async () => {
diff --git a/products/customer_analytics/frontend/components/Accounts/AccountMeetingsExpansion.tsx b/products/customer_analytics/frontend/components/Accounts/AccountMeetingsExpansion.tsx
index 44b5ee6b373b..ae538cfd056a 100644
--- a/products/customer_analytics/frontend/components/Accounts/AccountMeetingsExpansion.tsx
+++ b/products/customer_analytics/frontend/components/Accounts/AccountMeetingsExpansion.tsx
@@ -17,6 +17,7 @@ import {
import { pngHoggie } from 'lib/brand/hoggies'
import { TZLabel } from 'lib/components/TZLabel'
+import { dayjs } from 'lib/dayjs'
import { urls } from 'scenes/urls'
import gongIcon from 'public/services/gong.png'
@@ -228,8 +229,17 @@ export function AccountMeetingsExpansion({
{
title: 'When',
key: 'start_time',
- width: 140,
- render: (_, meeting) => <TZLabel time={meeting.start_time} />,
+ width: 180,
+ render: (_, meeting) => (
+ <div className="flex items-center gap-1 whitespace-nowrap">
+ <TZLabel time={meeting.start_time} />
+ {meeting.is_recurring && dayjs(meeting.start_time).isAfter(dayjs()) && (
+ <LemonTag type="muted" size="small" title="Later occurrences of this series are hidden">
+ Recurring
+ </LemonTag>
+ )}
+ </div>
+ ),
sorter: (a, b) => a.start_time.localeCompare(b.start_time),
},
{
diff --git a/products/customer_analytics/frontend/generated/api.schemas.ts b/products/customer_analytics/frontend/generated/api.schemas.ts
index 26505328e018..2c77b878d4e1 100644
--- a/products/customer_analytics/frontend/generated/api.schemas.ts
+++ b/products/customer_analytics/frontend/generated/api.schemas.ts
@@ -1178,6 +1178,8 @@ export interface MeetingApi {
readonly id: string
/** Meeting title; may be empty. */
readonly title: string
+ /** Whether the meeting belongs to a recurring series. Account meeting lists include all past occurrences and only the next upcoming, non-canceled occurrence of each series. */
+ readonly is_recurring: boolean
/**
* Gong call URL matched through the calendar event id; null when no Gong call is available.
* @nullable
diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/CustomerAnalyticsAccountScene.stories.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/CustomerAnalyticsAccountScene.stories.tsx
index 818d84704d12..488efd798d11 100644
--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/CustomerAnalyticsAccountScene.stories.tsx
+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/CustomerAnalyticsAccountScene.stories.tsx
@@ -6,7 +6,11 @@ import { urls } from 'scenes/urls'
import { mswDecorator } from '~/mocks/browser'
-import type { CustomPropertyValueWriteApi, AccountRelationshipWriteApi } from '../../generated/api.schemas'
+import type {
+ CustomPropertyValueWriteApi,
+ AccountRelationshipWriteApi,
+ PaginatedMeetingListApi,
+} from '../../generated/api.schemas'
import { createAccountViewContent } from './accountViewDocument'
const ACCOUNT_ID = '11111111-2222-4333-8444-555555555555'
@@ -15,6 +19,7 @@ const URL_UNSAFE_EXTERNAL_ACCOUNT_ID = 'spaces %2F slash / ? # + Unicode 漢字'
const ACCOUNT_RETRIEVE_ENDPOINT = 'api/projects/:team_id/accounts/:account_id/'
const ACCOUNT_BY_EXTERNAL_ID_ENDPOINT = 'api/projects/:team_id/accounts/by_external_id/'
const ACCOUNT_NOTEBOOKS_ENDPOINT = 'api/projects/:team_id/accounts/:account_id/notebooks/'
+const ACCOUNT_MEETINGS_ENDPOINT = 'api/projects/:team_id/accounts/:account_id/meetings/'
const ACCOUNT_PRESENCE_ENDPOINT = 'api/projects/:team_id/accounts/:account_id/presence/'
const ACCOUNT_ICON_ENDPOINT = 'api/projects/:team_id/accounts/icon/'
const VALUES_ENDPOINT = 'api/projects/:team_id/accounts/:account_id/custom_property_values/'
@@ -89,6 +94,24 @@ const notebooks = {
],
}
+const meetings: PaginatedMeetingListApi = {
+ count: 3,
+ next: null,
+ previous: null,
+ results: [
+ { id: 'meeting-next', title: 'Weekly review', start_time: '2026-05-23T12:00:00Z', is_recurring: true },
+ { id: 'meeting-one-off', title: 'Planning call', start_time: '2026-05-25T12:00:00Z', is_recurring: false },
+ { id: 'meeting-past', title: 'Previous weekly review', start_time: '2026-05-18T12:00:00Z', is_recurring: true },
+ ].map((meeting) => ({
+ ...meeting,
+ gong_url: null,
+ end_time: null,
+ organizer_email: '[email protected]',
+ status: 'confirmed',
+ participants: [],
+ })),
+}
+
const meta: Meta = {
component: App,
title: 'Scenes-App/Customer Analytics/Account detail',
@@ -216,6 +239,29 @@ export const Narrow: Story = {
},
}
+export const Meetings: Story = {
+ render: () => <App />,
+ decorators: [mswDecorator({ get: { [ACCOUNT_MEETINGS_ENDPOINT]: meetings } })],
+ parameters: {
+ pageUrl: urls.customerAnalyticsAccount(ACCOUNT_ID, 'meetings'),
+ testOptions: {
+ waitForSelector: ['[data-attr="customer-analytics-account-scene"]', '.LemonTable'],
+ viewport: { width: 1280, height: 900 },
+ },
+ },
+}
+
+export const MeetingsNarrow: Story = {
+ ...Meetings,
+ parameters: {
+ ...Meetings.parameters,
+ testOptions: {
+ waitForSelector: ['[data-attr="customer-analytics-account-scene"]', '.LemonTable'],
+ viewport: { width: 800, height: 900 },
+ },
+ },
+}
+
const pinnedDefinitions = [
['summary', 'Account summary', 'text', 'Evaluating the new dashboard'],
['website', 'Success plan', 'link', 'https://example.com/plan'],
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index ff46a8215d9b..818851286efa 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -63689,6 +63689,8 @@ export namespace Schemas {
readonly id: string;
/** Meeting title; may be empty. */
readonly title: string;
+ /** Whether the meeting belongs to a recurring series. Account meeting lists include all past occurrences and only the next upcoming, non-canceled occurrence of each series. */
+ readonly is_recurring: boolean;
/**
* Gong call URL matched through the calendar event id; null when no Gong call is available.
* @nullable