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.

fix(replay): run top-level element filters against events in the recordings list (#114985)

posthog[bot]03bd4ee19ef4
diff --git a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr
index b357b403fc3c..1ba06963e7bf 100644
--- a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr
+++ b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr
@@ -8184,129 +8184,6 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.176
- '''
- SELECT ("posthog_dashboardtile"."insight_id") AS "_prefetch_related_val_insight_id",
- "posthog_dashboard"."id",
- "posthog_dashboard"."name",
- "posthog_dashboard"."description",
- "posthog_dashboard"."team_id",
- "posthog_dashboard"."pinned",
- "posthog_dashboard"."created_at",
- "posthog_dashboard"."created_by_id",
- "posthog_dashboard"."deleted",
- "posthog_dashboard"."last_accessed_at",
- "posthog_dashboard"."last_refresh",
- "posthog_dashboard"."filters",
- "posthog_dashboard"."variables",
- "posthog_dashboard"."breakdown_colors",
- "posthog_dashboard"."data_color_theme_id",
- "posthog_dashboard"."creation_mode",
- "posthog_dashboard"."restriction_level",
- "posthog_dashboard"."quick_filter_ids",
- "posthog_dashboard"."customization",
- "posthog_dashboard"."deprecated_tags",
- "posthog_dashboard"."tags",
- "posthog_dashboard"."share_token",
- "posthog_dashboard"."is_shared"
- FROM "posthog_dashboard"
- INNER JOIN "posthog_dashboardtile" ON ("posthog_dashboard"."id" = "posthog_dashboardtile"."dashboard_id")
- WHERE (NOT ("posthog_dashboard"."deleted")
- AND "posthog_dashboard"."id" IN
- (SELECT U0."dashboard_id" AS "dashboard_id"
- FROM "posthog_dashboardtile" U0
- INNER JOIN "posthog_dashboard" U1 ON (U0."dashboard_id" = U1."id")
- WHERE (NOT (U0."deleted"
- AND U0."deleted" IS NOT NULL)
- AND NOT (U1."deleted")))
- AND "posthog_dashboardtile"."insight_id" IN (1,
- 2,
- 3,
- 4,
- 5 /* ... */))
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.177
- '''
- SELECT "posthog_dashboardtile"."id",
- "posthog_dashboardtile"."dashboard_id",
- "posthog_dashboardtile"."insight_id",
- "posthog_dashboardtile"."text_id",
- "posthog_dashboardtile"."button_tile_id",
- "posthog_dashboardtile"."widget_id",
- "posthog_dashboardtile"."team_id",
- "posthog_dashboardtile"."layouts",
- "posthog_dashboardtile"."color",
- "posthog_dashboardtile"."filters_hash",
- "posthog_dashboardtile"."last_refresh",
- "posthog_dashboardtile"."refreshing",
- "posthog_dashboardtile"."refresh_attempt",
- "posthog_dashboardtile"."filters_overrides",
- "posthog_dashboardtile"."show_description",
- "posthog_dashboardtile"."transparent_background",
- "posthog_dashboardtile"."deleted"
- FROM "posthog_dashboardtile"
- INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id")
- WHERE (NOT ("posthog_dashboardtile"."deleted"
- AND "posthog_dashboardtile"."deleted" IS NOT NULL)
- AND NOT ("posthog_dashboard"."deleted")
- AND "posthog_dashboardtile"."insight_id" IN (1,
- 2,
- 3,
- 4,
- 5 /* ... */))
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.178
- '''
- SELECT "posthog_dashboard"."id",
- "posthog_dashboard"."name",
- "posthog_dashboard"."description",
- "posthog_dashboard"."team_id",
- "posthog_dashboard"."pinned",
- "posthog_dashboard"."created_at",
- "posthog_dashboard"."created_by_id",
- "posthog_dashboard"."deleted",
- "posthog_dashboard"."last_accessed_at",
- "posthog_dashboard"."last_refresh",
- "posthog_dashboard"."filters",
- "posthog_dashboard"."variables",
- "posthog_dashboard"."breakdown_colors",
- "posthog_dashboard"."data_color_theme_id",
- "posthog_dashboard"."creation_mode",
- "posthog_dashboard"."restriction_level",
- "posthog_dashboard"."quick_filter_ids",
- "posthog_dashboard"."customization",
- "posthog_dashboard"."deprecated_tags",
- "posthog_dashboard"."tags",
- "posthog_dashboard"."share_token",
- "posthog_dashboard"."is_shared"
- FROM "posthog_dashboard"
- WHERE ("posthog_dashboard"."id") IN ((1,
- 2)/* ... */)
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.179
- '''
- SELECT "posthog_taggeditem"."id",
- "posthog_taggeditem"."tag_id",
- "posthog_taggeditem"."content_type_id",
- "posthog_taggeditem"."object_id",
- "posthog_taggeditem"."object_uuid",
- "posthog_taggeditem"."team_id",
- "posthog_tag"."id",
- "posthog_tag"."name",
- "posthog_tag"."team_id"
- FROM "posthog_taggeditem"
- INNER JOIN "posthog_tag" ON ("posthog_taggeditem"."tag_id" = "posthog_tag"."id")
- WHERE ("posthog_taggeditem"."content_type_id" = 99999
- AND "posthog_taggeditem"."object_id" IN (1,
- 2,
- 3,
- 4,
- 5 /* ... */))
- '''
-# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.18
'''
SELECT "posthog_insightvariable"."id",
@@ -8327,122 +8204,6 @@
ORDER BY "posthog_insightvariable"."name" ASC
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.180
- '''
- SELECT "posthog_alertconfiguration"."created_by_id",
- "posthog_alertconfiguration"."created_at",
- "posthog_alertconfiguration"."id",
- "posthog_alertconfiguration"."team_id",
- "posthog_alertconfiguration"."insight_id",
- "posthog_alertconfiguration"."name",
- "posthog_alertconfiguration"."config",
- "posthog_alertconfiguration"."evaluation_delay_intervals",
- "posthog_alertconfiguration"."calculation_interval",
- "posthog_alertconfiguration"."threshold_id",
- "posthog_alertconfiguration"."condition",
- "posthog_alertconfiguration"."detector_config",
- "posthog_alertconfiguration"."state",
- "posthog_alertconfiguration"."enabled",
- "posthog_alertconfiguration"."last_notified_at",
- "posthog_alertconfiguration"."last_checked_at",
- "posthog_alertconfiguration"."next_check_at",
- "posthog_alertconfiguration"."snoozed_until",
- "posthog_alertconfiguration"."skip_weekend",
- "posthog_alertconfiguration"."schedule_restriction",
- "posthog_alertconfiguration"."schedule_start_time",
- "posthog_alertconfiguration"."investigation_agent_enabled",
- "posthog_alertconfiguration"."investigation_gates_notifications",
- "posthog_alertconfiguration"."investigation_inconclusive_action",
- "posthog_user"."id",
- "posthog_user"."password",
- "posthog_user"."last_login",
- "posthog_user"."first_name",
- "posthog_user"."last_name",
- "posthog_user"."is_staff",
- "posthog_user"."date_joined",
- "posthog_user"."uuid",
- "posthog_user"."current_organization_id",
- "posthog_user"."current_team_id",
- "posthog_user"."email",
- "posthog_user"."pending_email",
- "posthog_user"."distinct_id",
- "posthog_user"."is_email_verified",
- "posthog_user"."credentials_reviewed_at",
- "posthog_user"."requested_password_reset_at",
- "posthog_user"."requested_2fa_reset_at",
- "posthog_user"."has_seen_product_intro_for",
- "posthog_user"."strapi_id",
- "posthog_user"."is_active",
- "posthog_user"."role_at_organization",
- "posthog_user"."theme_mode",
- "posthog_user"."partial_notification_settings",
- "posthog_user"."anonymize_data",
- "posthog_user"."allow_impersonation",
- "posthog_user"."toolbar_mode",
- "posthog_user"."hedgehog_config",
- "posthog_user"."allow_sidebar_suggestions",
- "posthog_user"."shortcut_position",
- "posthog_user"."passkeys_enabled_for_2fa",
- "posthog_user"."hide_mcp_hints",
- "posthog_user"."ui_configuration",
- "posthog_user"."onboarding_skipped_at",
- "posthog_user"."onboarding_skipped_reason",
- "posthog_user"."onboarding_skipped_organization_id",
- "posthog_user"."onboarding_delegated_to_invite_id",
- "posthog_user"."onboarding_delegated_to_organization_id",
- "posthog_user"."onboarding_delegation_accepted_at",
- "posthog_user"."events_column_config",
- "posthog_user"."email_opt_in",
- "posthog_threshold"."created_by_id",
- "posthog_threshold"."created_at",
- "posthog_threshold"."id",
- "posthog_threshold"."team_id",
- "posthog_threshold"."insight_id",
- "posthog_threshold"."name",
- "posthog_threshold"."configuration"
- FROM "posthog_alertconfiguration"
- LEFT OUTER JOIN "posthog_user" ON ("posthog_alertconfiguration"."created_by_id" = "posthog_user"."id")
- LEFT OUTER JOIN "posthog_threshold" ON ("posthog_alertconfiguration"."threshold_id" = "posthog_threshold"."id")
- WHERE "posthog_alertconfiguration"."insight_id" IN (1,
- 2,
- 3,
- 4,
- 5 /* ... */)
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.181
- '''
- SELECT "posthog_dashboard"."id",
- "posthog_dashboard"."name",
- "posthog_dashboard"."description",
- "posthog_dashboard"."team_id",
- "posthog_dashboard"."pinned",
- "posthog_dashboard"."created_at",
- "posthog_dashboard"."created_by_id",
- "posthog_dashboard"."deleted",
- "posthog_dashboard"."last_accessed_at",
- "posthog_dashboard"."last_refresh",
- "posthog_dashboard"."filters",
- "posthog_dashboard"."variables",
- "posthog_dashboard"."breakdown_colors",
- "posthog_dashboard"."data_color_theme_id",
- "posthog_dashboard"."creation_mode",
- "posthog_dashboard"."restriction_level",
- "posthog_dashboard"."quick_filter_ids",
- "posthog_dashboard"."customization",
- "posthog_dashboard"."deprecated_tags",
- "posthog_dashboard"."tags",
- "posthog_dashboard"."share_token",
- "posthog_dashboard"."is_shared"
- FROM "posthog_dashboard"
- WHERE (NOT ("posthog_dashboard"."deleted")
- AND "posthog_dashboard"."id" IN (1,
- 2,
- 3,
- 4,
- 5 /* ... */))
- '''
-# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.19
'''
SELECT "posthog_dashboardtile"."id",
@@ -13593,368 +13354,6 @@
ORDER BY "posthog_dashboarditem"."order" ASC
'''
# ---
-# name: TestDashboard.test_retrieve_dashboard.18
- '''
- SELECT "posthog_dashboardtile"."id",
- "posthog_dashboardtile"."dashboard_id",
- "posthog_dashboardtile"."insight_id",
- "posthog_dashboardtile"."text_id",
- "posthog_dashboardtile"."button_tile_id",
- "posthog_dashboardtile"."widget_id",
- "posthog_dashboardtile"."team_id",
- "posthog_dashboardtile"."layouts",
- "posthog_dashboardtile"."color",
- "posthog_dashboardtile"."filters_hash",
- "posthog_dashboardtile"."last_refresh",
- "posthog_dashboardtile"."refreshing",
- "posthog_dashboardtile"."refresh_attempt",
- "posthog_dashboardtile"."filters_overrides",
- "posthog_dashboardtile"."show_description",
- "posthog_dashboardtile"."transparent_background",
- "posthog_dashboardtile"."deleted",
- "posthog_dashboarditem"."id",
- "posthog_dashboarditem"."name",
- "posthog_dashboarditem"."derived_name",
- "posthog_dashboarditem"."description",
- "posthog_dashboarditem"."team_id",
- "posthog_dashboarditem"."filters",
- "posthog_dashboarditem"."filters_hash",
- "posthog_dashboarditem"."query",
- "posthog_dashboarditem"."query_metadata",
- "posthog_dashboarditem"."order",
- "posthog_dashboarditem"."deleted",
- "posthog_dashboarditem"."saved",
- "posthog_dashboarditem"."created_at",
- "posthog_dashboarditem"."refreshing",
- "posthog_dashboarditem"."created_by_id",
- "posthog_dashboarditem"."is_sample",
- "posthog_dashboarditem"."short_id",
- "posthog_dashboarditem"."favorited",
- "posthog_dashboarditem"."refresh_attempt",
- "posthog_dashboarditem"."last_modified_at",
- "posthog_dashboarditem"."last_modified_by_id",
- "posthog_dashboarditem"."dashboard_id",
- "posthog_dashboarditem"."last_refresh",
- "posthog_dashboarditem"."layouts",
- "posthog_dashboarditem"."color",
- "posthog_dashboarditem"."dive_dashboard_id",
- "posthog_dashboarditem"."updated_at",
- "posthog_dashboarditem"."deprecated_tags",
- "posthog_dashboarditem"."tags",
- "posthog_team"."id",
- "posthog_team"."uuid",
- "posthog_team"."organization_id",
- "posthog_team"."parent_team_id",
- "posthog_team"."project_id",
- "posthog_team"."api_token",
- "posthog_team"."app_urls",
- "posthog_team"."name",
- "posthog_team"."slack_incoming_webhook",
- "posthog_team"."created_at",
- "posthog_team"."updated_at",
- "posthog_team"."anonymize_ips",
- "posthog_team"."completed_snippet_onboarding",
- "posthog_team"."has_completed_onboarding_for",
- "posthog_team"."onboarding_tasks",
- "posthog_team"."ingested_event",
- "posthog_team"."ingested_production_event",
- "posthog_team"."ingested_production_event_last_checked_at",
- "posthog_team"."person_processing_opt_out",
- "posthog_team"."secret_api_token",
- "posthog_team"."secret_api_token_backup",
- "posthog_team"."session_recording_opt_in",
- "posthog_team"."session_recording_sample_rate",
- "posthog_team"."session_recording_minimum_duration_milliseconds",
- "posthog_team"."session_recording_linked_flag",
- "posthog_team"."session_recording_network_payload_capture_config",
- "posthog_team"."session_recording_masking_config",
- "posthog_team"."session_recording_url_trigger_config",
- "posthog_team"."session_recording_url_blocklist_config",
- "posthog_team"."session_recording_event_trigger_config",
- "posthog_team"."session_recording_trigger_match_type_config",
- "posthog_team"."session_recording_trigger_groups",
- "posthog_team"."session_replay_config",
- "posthog_team"."session_recording_retention_period",
- "posthog_team"."event_retention_months",
- "posthog_team"."conversations_enabled",
- "posthog_team"."conversations_settings",
- "posthog_team"."proactive_tasks_enabled",
- "posthog_team"."survey_config",
- "posthog_team"."surveys_opt_in",
- "posthog_team"."product_tours_opt_in",
- "posthog_team"."capture_console_log_opt_in",
- "posthog_team"."capture_performance_opt_in",
- "posthog_team"."capture_dead_clicks",
- "posthog_team"."autocapture_opt_out",
- "posthog_team"."autocapture_web_vitals_opt_in",
- "posthog_team"."autocapture_web_vitals_allowed_metrics",
- "posthog_team"."autocapture_exceptions_opt_in",
- "posthog_team"."autocapture_exceptions_errors_to_ignore",
- "posthog_team"."logs_settings",
- "posthog_team"."llm_gateway_enabled_at",
- "posthog_team"."llm_gateway_revoked_at",
- "posthog_team"."llm_gateway_overspend_allowance_usd",
- "posthog_team"."heatmaps_opt_in",
- "posthog_team"."receive_org_level_activity_logs",
- "posthog_team"."web_analytics_pre_aggregated_tables_enabled",
- "posthog_team"."web_analytics_pre_aggregated_tables_version",
- "posthog_team"."flags_persistence_default",
- "posthog_team"."feature_flag_confirmation_enabled",
- "posthog_team"."feature_flag_confirmation_message",
- "posthog_team"."default_evaluation_environments_enabled",
- "posthog_team"."require_evaluation_environment_tags",
- "posthog_team"."default_evaluation_contexts_enabled",
- "posthog_team"."require_evaluation_contexts",
- "posthog_team"."session_recording_version",
- "posthog_team"."signup_token",
- "posthog_team"."is_demo",
- "posthog_team"."access_control",
- "posthog_team"."week_start_day",
- "posthog_team"."inject_web_apps",
- "posthog_team"."test_account_filters",
- "posthog_team"."test_account_filters_default_checked",
- "posthog_team"."path_cleaning_filters",
- "posthog_team"."timezone",
- "posthog_team"."data_attributes",
- "posthog_team"."person_display_name_properties",
- "posthog_team"."live_events_columns",
- "posthog_team"."recording_domains",
- "posthog_team"."human_friendly_comparison_periods",
- "posthog_team"."cookieless_server_hash_mode",
- "posthog_team"."primary_dashboard_id",
- "posthog_team"."default_data_theme",
- "posthog_team"."extra_settings",
- "posthog_team"."modifiers",
- "posthog_team"."correlation_config",
- "posthog_team"."session_recording_retention_period_days",
- "posthog_team"."plugins_opt_in",
- "posthog_team"."opt_out_capture",
- "posthog_team"."event_names",
- "posthog_team"."event_names_with_usage",
- "posthog_team"."event_properties",
- "posthog_team"."event_properties_with_usage",
- "posthog_team"."event_properties_numerical",
- "posthog_team"."external_data_workspace_id",
- "posthog_team"."external_data_workspace_last_synced_at",
- "posthog_team"."api_query_rate_limit",
- "posthog_team"."revenue_tracking_config",
- "posthog_team"."drop_events_older_than",
- "posthog_team"."base_currency",
- "posthog_team"."business_model",
- "posthog_user"."id",
- "posthog_user"."password",
- "posthog_user"."last_login",
- "posthog_user"."first_name",
- "posthog_user"."last_name",
- "posthog_user"."is_staff",
- "posthog_user"."date_joined",
- "posthog_user"."uuid",
- "posthog_user"."current_organization_id",
- "posthog_user"."current_team_id",
- "posthog_user"."email",
- "posthog_user"."pending_email",
- "posthog_user"."distinct_id",
- "posthog_user"."is_email_verified",
- "posthog_user"."credentials_reviewed_at",
- "posthog_user"."requested_password_reset_at",
- "posthog_user"."requested_2fa_reset_at",
- "posthog_user"."has_seen_product_intro_for",
- "posthog_user"."strapi_id",
- "posthog_user"."is_active",
- "posthog_user"."role_at_organization",
- "posthog_user"."theme_mode",
- "posthog_user"."partial_notification_settings",
- "posthog_user"."anonymize_data",
- "posthog_user"."allow_impersonation",
- "posthog_user"."toolbar_mode",
- "posthog_user"."hedgehog_config",
- "posthog_user"."allow_sidebar_suggestions",
- "posthog_user"."shortcut_position",
- "posthog_user"."passkeys_enabled_for_2fa",
- "posthog_user"."hide_mcp_hints",
- "posthog_user"."ui_configuration",
- "posthog_user"."onboarding_skipped_at",
- "posthog_user"."onboarding_skipped_reason",
- "posthog_user"."onboarding_skipped_organization_id",
- "posthog_user"."onboarding_delegated_to_invite_id",
- "posthog_user"."onboarding_delegated_to_organization_id",
- "posthog_user"."onboarding_delegation_accepted_at",
- "posthog_user"."events_column_config",
- "posthog_user"."email_opt_in",
- T6."id",
- T6."password",
- T6."last_login",
- T6."first_name",
- T6."last_name",
- T6."is_staff",
- T6."date_joined",
- T6."uuid",
- T6."current_organization_id",
- T6."current_team_id",
- T6."email",
- T6."pending_email",
- T6."distinct_id",
- T6."is_email_verified",
- T6."credentials_reviewed_at",
- T6."requested_password_reset_at",
- T6."requested_2fa_reset_at",
- T6."has_seen_product_intro_for",
- T6."strapi_id",
- T6."is_active",
- T6."role_at_organization",
- T6."theme_mode",
- T6."partial_notification_settings",
- T6."anonymize_data",
- T6."allow_impersonation",
- T6."toolbar_mode",
- T6."hedgehog_config",
- T6."allow_sidebar_suggestions",
- T6."shortcut_position",
- T6."passkeys_enabled_for_2fa",
- T6."hide_mcp_hints",
- T6."ui_configuration",
- T6."onboarding_skipped_at",
- T6."onboarding_skipped_reason",
- T6."onboarding_skipped_organization_id",
- T6."onboarding_delegated_to_invite_id",
- T6."onboarding_delegated_to_organization_id",
- T6."onboarding_delegation_accepted_at",
- T6."events_column_config",
- T6."email_opt_in",
- "posthog_text"."id",
- "posthog_text"."body",
- "posthog_text"."agent_context",
- "posthog_text"."created_by_id",
- "posthog_text"."last_modified_at",
- "posthog_text"."last_modified_by_id",
- "posthog_text"."team_id",
- "posthog_buttontile"."id",
- "posthog_buttontile"."url",
- "posthog_buttontile"."text",
- "posthog_buttontile"."placement",
- "posthog_buttontile"."style",
- "posthog_buttontile"."created_by_id",
- "posthog_buttontile"."last_modified_at",
- "posthog_buttontile"."last_modified_by_id",
- "posthog_buttontile"."team_id",
- "posthog_dashboardwidget"."id",
- "posthog_dashboardwidget"."widget_type",
- "posthog_dashboardwidget"."name",
- "posthog_dashboardwidget"."description",
- "posthog_dashboardwidget"."config",
- "posthog_dashboardwidget"."created_by_id",
- "posthog_dashboardwidget"."last_modified_at",
- "posthog_dashboardwidget"."last_modified_by_id",
- "posthog_dashboardwidget"."team_id",
- T10."id",
- T10."password",
- T10."last_login",
- T10."first_name",
- T10."last_name",
- T10."is_staff",
- T10."date_joined",
- T10."uuid",
- T10."current_organization_id",
- T10."current_team_id",
- T10."email",
- T10."pending_email",
- T10."distinct_id",
- T10."is_email_verified",
- T10."credentials_reviewed_at",
- T10."requested_password_reset_at",
- T10."requested_2fa_reset_at",
- T10."has_seen_product_intro_for",
- T10."strapi_id",
- T10."is_active",
- T10."role_at_organization",
- T10."theme_mode",
- T10."partial_notification_settings",
- T10."anonymize_data",
- T10."allow_impersonation",
- T10."toolbar_mode",
- T10."hedgehog_config",
- T10."allow_sidebar_suggestions",
- T10."shortcut_position",
- T10."passkeys_enabled_for_2fa",
- T10."hide_mcp_hints",
- T10."ui_configuration",
- T10."onboarding_skipped_at",
- T10."onboarding_skipped_reason",
- T10."onboarding_skipped_organization_id",
- T10."onboarding_delegated_to_invite_id",
- T10."onboarding_delegated_to_organization_id",
- T10."onboarding_delegation_accepted_at",
- T10."events_column_config",
- T10."email_opt_in",
- T11."id",
- T11."password",
- T11."last_login",
- T11."first_name",
- T11."last_name",
- T11."is_staff",
- T11."date_joined",
- T11."uuid",
- T11."current_organization_id",
- T11."current_team_id",
- T11."email",
- T11."pending_email",
- T11."distinct_id",
- T11."is_email_verified",
- T11."credentials_reviewed_at",
- T11."requested_password_reset_at",
- T11."requested_2fa_reset_at",
- T11."has_seen_product_intro_for",
- T11."strapi_id",
- T11."is_active",
- T11."role_at_organization",
- T11."theme_mode",
- T11."partial_notification_settings",
- T11."anonymize_data",
- T11."allow_impersonation",
- T11."toolbar_mode",
- T11."hedgehog_config",
- T11."allow_sidebar_suggestions",
- T11."shortcut_position",
- T11."passkeys_enabled_for_2fa",
- T11."hide_mcp_hints",
- T11."ui_configuration",
- T11."onboarding_skipped_at",
- T11."onboarding_skipped_reason",
- T11."onboarding_skipped_organization_id",
- T11."onboarding_delegated_to_invite_id",
- T11."onboarding_delegated_to_organization_id",
- T11."onboarding_delegation_accepted_at",
- T11."events_column_config",
- T11."email_opt_in"
- FROM "posthog_dashboardtile"
- INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id")
- LEFT OUTER JOIN "posthog_dashboarditem" ON ("posthog_dashboardtile"."insight_id" = "posthog_dashboarditem"."id")
- LEFT OUTER JOIN "posthog_team" ON ("posthog_dashboarditem"."team_id" = "posthog_team"."id")
- LEFT OUTER JOIN "posthog_user" ON ("posthog_dashboarditem"."created_by_id" = "posthog_user"."id")
- LEFT OUTER JOIN "posthog_user" T6 ON ("posthog_dashboarditem"."last_modified_by_id" = T6."id")
- LEFT OUTER JOIN "posthog_text" ON ("posthog_dashboardtile"."text_id" = "posthog_text"."id")
- LEFT OUTER JOIN "posthog_buttontile" ON ("posthog_dashboardtile"."button_tile_id" = "posthog_buttontile"."id")
- LEFT OUTER JOIN "posthog_dashboardwidget" ON ("posthog_dashboardtile"."widget_id" = "posthog_dashboardwidget"."id")
- LEFT OUTER JOIN "posthog_user" T10 ON ("posthog_dashboardwidget"."created_by_id" = T10."id")
- LEFT OUTER JOIN "posthog_user" T11 ON ("posthog_dashboardwidget"."last_modified_by_id" = T11."id")
- WHERE (NOT ("posthog_dashboardtile"."deleted"
- AND "posthog_dashboardtile"."deleted" IS NOT NULL)
- AND NOT ("posthog_dashboard"."deleted")
- AND NOT ("posthog_dashboard"."deleted"
- AND "posthog_dashboardtile"."deleted"
- AND "posthog_dashboardtile"."deleted" IS NOT NULL)
- AND (NOT "posthog_dashboarditem"."deleted"
- OR "posthog_dashboardtile"."insight_id" IS NULL)
- AND "posthog_dashboardtile"."dashboard_id" = 99999
- AND "posthog_dashboardtile"."dashboard_id" = 99999
- AND NOT ("posthog_dashboard"."deleted"
- AND "posthog_dashboardtile"."deleted"
- AND "posthog_dashboardtile"."deleted" IS NOT NULL)
- AND (NOT "posthog_dashboarditem"."deleted"
- OR "posthog_dashboardtile"."insight_id" IS NULL))
- ORDER BY "posthog_dashboarditem"."order" ASC
- '''
-# ---
# name: TestDashboard.test_retrieve_dashboard.2
'''
SELECT "posthog_organization"."id",
diff --git a/posthog/session_recordings/queries/test/listing_recordings/test_session_recording_list_by_top_level_event_property.py b/posthog/session_recordings/queries/test/listing_recordings/test_session_recording_list_by_top_level_event_property.py
index 4fc60f4d564a..df93928fcab1 100644
--- a/posthog/session_recordings/queries/test/listing_recordings/test_session_recording_list_by_top_level_event_property.py
+++ b/posthog/session_recordings/queries/test/listing_recordings/test_session_recording_list_by_top_level_event_property.py
@@ -10,7 +10,7 @@ from parameterized import parameterized, parameterized_class
from posthog.clickhouse.client import sync_execute
from posthog.clickhouse.log_entries import TRUNCATE_LOG_ENTRIES_TABLE_SQL
-from posthog.models import EventProperty
+from posthog.models import Element, EventProperty
from posthog.models.team import Team
from posthog.models.utils import uuid7
from posthog.session_recordings.queries.session_recording_list_from_query import SessionRecordingQueryResult
@@ -481,3 +481,35 @@ class TestSessionRecordingsListByTopLevelEventProperty(ClickhouseTestMixin, APIB
},
[paul_google_session, no_email_session],
)
+
+ @parameterized.expand(
+ [
+ ("icontains", "icontains", ["chat_session"]),
+ ("not_icontains", "not_icontains", ["other_session"]),
+ ]
+ )
+ @time_machine.travel("2021-01-21T20:00:00.000Z", tick=False)
+ def test_can_filter_by_top_level_element_text(self, _name: str, operator: str, expected: list[str]) -> None:
+ sessions = {"chat_session": str(uuid7()), "other_session": str(uuid7())}
+ texts = {"chat_session": "Open chat", "other_session": "Cancel"}
+ for label, session_id in sessions.items():
+ produce_replay_summary(
+ distinct_id="user",
+ session_id=session_id,
+ first_timestamp=self.an_hour_ago,
+ team_id=self.team.id,
+ ensure_analytics_event_in_session=False,
+ )
+ create_event(
+ team=self.team,
+ distinct_id="user",
+ timestamp=self.an_hour_ago + timedelta(minutes=1),
+ event_name="$autocapture",
+ properties={"$session_id": session_id, "$window_id": str(uuid7())},
+ elements=[Element(tag_name="button", text=texts[label], nth_child=0, nth_of_type=0)],
+ )
+
+ self._assert_query_matches_session_ids(
+ {"properties": [{"type": "element", "key": "text", "operator": operator, "value": "chat"}]},
+ [sessions[label] for label in expected],
+ )
diff --git a/posthog/session_recordings/queries/test/listing_recordings/test_utils.py b/posthog/session_recordings/queries/test/listing_recordings/test_utils.py
index 90fc8ee58a7c..ae28494d6c24 100644
--- a/posthog/session_recordings/queries/test/listing_recordings/test_utils.py
+++ b/posthog/session_recordings/queries/test/listing_recordings/test_utils.py
@@ -4,7 +4,7 @@ from posthog.test.base import _create_event
from posthog.schema import RecordingsQuery
-from posthog.models import Team, User
+from posthog.models import Element, Team, User
from posthog.session_recordings.queries.session_recording_list_from_query import (
SessionRecordingListFromQuery,
SessionRecordingQueryResult,
@@ -18,6 +18,7 @@ def create_event(
team: Team,
event_name: str = "$pageview",
properties: dict | None = None,
+ elements: list[Element] | None = None,
) -> str:
if properties is None:
properties = {"$os": "Windows 95", "$current_url": "aloha.com/2"}
@@ -27,6 +28,7 @@ def create_event(
timestamp=timestamp,
distinct_id=distinct_id,
properties=properties,
+ elements=elements,
)
diff --git a/posthog/session_recordings/queries/utils.py b/posthog/session_recordings/queries/utils.py
index bd1523b0d704..d97c4e0bd4c9 100644
--- a/posthog/session_recordings/queries/utils.py
+++ b/posthog/session_recordings/queries/utils.py
@@ -92,7 +92,12 @@ INVERSE_OPERATOR_FOR = {
def is_event_property(p: AnyPropertyFilter) -> bool:
p_type = getattr(p, "type", None)
p_key = getattr(p, "key", "")
- return p_type == "event" or (p_type == "hogql" and bool(re.search(r"(?<!person\.)properties\.", p_key)))
+ # Element filters read `elements_chain_*` columns, which exist only on the events table.
+ return (
+ p_type == "event"
+ or p_type == "element"
+ or (p_type == "hogql" and bool(re.search(r"(?<!person\.)properties\.", p_key)))
+ )
def is_person_property(p: AnyPropertyFilter) -> bool: