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(workflows): roll out email assets UI to everyone (#68842)

Meikel Ratz9d11efaf7521
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 762463421850..17335a09ad80 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -525,7 +525,6 @@ export const FEATURE_FLAGS = {
WEB_ANALYTICS_TILE_SKELETONS: 'web-analytics-tile-skeletons', // owner: @jordanm-posthog #team-web-analytics
WEB_ANALYTICS_TILE_TOGGLES: 'web-analytics-tile-toggles', // owner: @lricoy #team-web-analytics
WEB_ANALYTICS_TOOLTIP_COMPARISON_LABELS: 'web-analytics-tooltip-comparison-labels', // owner: @lricoy #team-web-analytics
- WORKFLOW_EMAIL_ASSETS_UI: 'workflow-email-assets-ui', // owner: #team-workflows
WORKFLOWS_BATCH_TRIGGERS: 'workflows-batch-triggers', // owner: #team-workflows
WORKFLOWS_ENGAGEMENT_EVENTS: 'workflows-engagement-events', // owner: #team-workflows
WORKFLOWS_INTERNAL_EVENT_FILTERS: 'workflows-internal-event-filters', // owner: @haven #team-workflows
diff --git a/frontend/src/scenes/persons/PersonScene.tsx b/frontend/src/scenes/persons/PersonScene.tsx
index 9b535476015d..811b8b44b0a2 100644
--- a/frontend/src/scenes/persons/PersonScene.tsx
+++ b/frontend/src/scenes/persons/PersonScene.tsx
@@ -10,7 +10,6 @@ import { CopyToClipboardInline } from 'lib/components/CopyToClipboard'
import { NotFound } from 'lib/components/NotFound'
import { PropertiesTable } from 'lib/components/PropertiesTable'
import { TZLabel } from 'lib/components/TZLabel'
-import { FEATURE_FLAGS } from 'lib/constants'
import { groupsAccessLogic } from 'lib/introductions/groupsAccessLogic'
import { IconOpenInApp } from 'lib/lemon-ui/icons'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
@@ -18,7 +17,6 @@ import { LemonTabs } from 'lib/lemon-ui/LemonTabs'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { SpinnerOverlay } from 'lib/lemon-ui/Spinner/Spinner'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { copyToClipboard } from 'lib/utils/copyToClipboard'
import { isMobile } from 'lib/utils/dom'
import { pluralize } from 'lib/utils/strings'
@@ -210,8 +208,6 @@ export function PersonScene(): JSX.Element | null {
const { currentTeam } = useValues(teamLogic)
const { addProductIntentForCrossSell } = useActions(teamLogic)
const { user } = useValues(userLogic)
- const { featureFlags } = useValues(featureFlagLogic)
- const emailAssetsUIEnabled = !!featureFlags[FEATURE_FLAGS.WORKFLOW_EMAIL_ASSETS_UI]
const eventsQueryLogicKey = `${PERSON_EVENTS_CONTEXT_KEY}-${mountedPersonsLogic.key}`
if (personError) {
@@ -401,7 +397,7 @@ export function PersonScene(): JSX.Element | null {
label: <span data-attr="persons-logs-tab">Logs</span>,
content: <PersonLogsTab person={person} />,
},
- emailAssetsUIEnabled && person.uuid
+ person.uuid
? {
key: PersonsTabType.EMAILS,
label: <span data-attr="persons-emails-tab">Emails</span>,
diff --git a/posthog/api/person.py b/posthog/api/person.py
index dadcd53a8ef6..a3c2261def2f 100644
--- a/posthog/api/person.py
+++ b/posthog/api/person.py
@@ -84,7 +84,6 @@ from products.workflows.backend.api.message_assets import (
MessageAssetSerializer,
PersonMessageAssetsRequestSerializer,
fetch_message_assets_for_person,
- workflow_email_assets_ui_enabled,
)
from products.workflows.backend.models.hog_flow.hog_flow import HogFlow
@@ -1468,8 +1467,6 @@ class PersonViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):
@action(methods=["GET"], detail=True, required_scopes=["person:read"], pagination_class=None, filter_backends=[])
def emails(self, request: request.Request, *args: Any, **kwargs: Any) -> response.Response:
person = self.get_object()
- if not workflow_email_assets_ui_enabled(self.team, request.user):
- raise NotFound()
param_serializer = PersonMessageAssetsRequestSerializer(data=request.query_params)
param_serializer.is_valid(raise_exception=True)
params = param_serializer.validated_data
diff --git a/products/workflows/backend/api/hog_flow.py b/products/workflows/backend/api/hog_flow.py
index 2be7a6c3abc3..c18247958e40 100644
--- a/products/workflows/backend/api/hog_flow.py
+++ b/products/workflows/backend/api/hog_flow.py
@@ -78,7 +78,6 @@ from products.workflows.backend.api.message_assets import (
MessageAssetsRequestSerializer,
fetch_message_asset_html,
fetch_message_assets,
- workflow_email_assets_ui_enabled,
)
from products.workflows.backend.models.hog_flow.hog_flow import (
BILLABLE_ACTION_TYPES,
@@ -1606,8 +1605,6 @@ class HogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMixin, vie
@action(detail=True, methods=["GET"], pagination_class=None, filter_backends=[])
def assets(self, request: Request, *args, **kwargs):
obj = self.get_object()
- if not workflow_email_assets_ui_enabled(self.team, request.user):
- raise exceptions.NotFound()
tag_queries(product=ProductKey.WORKFLOWS, feature=Feature.QUERY)
param_serializer = MessageAssetsRequestSerializer(data=request.query_params)
@@ -1645,8 +1642,6 @@ class HogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMixin, vie
def asset_content(self, request: Request, *args, **kwargs):
# Ownership-check the HogFlow first so other teams' assets can't be probed.
obj = self.get_object()
- if not workflow_email_assets_ui_enabled(self.team, request.user):
- raise exceptions.NotFound()
param_serializer = MessageAssetContentRequestSerializer(data=request.query_params)
param_serializer.is_valid(raise_exception=True)
diff --git a/products/workflows/backend/api/message_assets.py b/products/workflows/backend/api/message_assets.py
index 844bc6cb9e44..0f89cf00fbbc 100644
--- a/products/workflows/backend/api/message_assets.py
+++ b/products/workflows/backend/api/message_assets.py
@@ -1,39 +1,11 @@
import dataclasses
from datetime import UTC, datetime
-from typing import TYPE_CHECKING, Any, Optional, cast
+from typing import Any, Optional, cast
-import posthoganalytics
from rest_framework import serializers
from posthog.clickhouse.client.execute import sync_execute
-if TYPE_CHECKING:
- from django.contrib.auth.models import AbstractBaseUser, AnonymousUser
-
- from posthog.models import Team
-
-
-WORKFLOW_EMAIL_ASSETS_UI_FLAG = "workflow-email-assets-ui"
-
-
-def workflow_email_assets_ui_enabled(team: "Team", user: "AbstractBaseUser | AnonymousUser") -> bool:
- # DRF's `request.user` is User | AnonymousUser. Permissions reject anonymous before
- # we get here, but typing it broadly lets callers pass `request.user` without casting.
- distinct_id = getattr(user, "distinct_id", None)
- if not distinct_id:
- return False
- return bool(
- posthoganalytics.feature_enabled(
- WORKFLOW_EMAIL_ASSETS_UI_FLAG,
- str(distinct_id),
- groups={"organization": str(team.organization_id), "project": str(team.id)},
- group_properties={"organization": {"id": str(team.organization_id)}},
- only_evaluate_locally=False,
- send_feature_flag_events=False,
- )
- )
-
-
# `latest_` prefix on the argMax aliases prevents collision with the raw column
# names in any outer WHERE — ClickHouse resolves the bare name to the aggregate
# and errors otherwise.
diff --git a/products/workflows/backend/api/test/test_message_assets.py b/products/workflows/backend/api/test/test_message_assets.py
index 66314887b125..a0c6db3f5feb 100644
--- a/products/workflows/backend/api/test/test_message_assets.py
+++ b/products/workflows/backend/api/test/test_message_assets.py
@@ -2,7 +2,6 @@ from datetime import UTC, datetime, timedelta
from typing import Any, Optional
from posthog.test.base import APIBaseTest, ClickhouseTestMixin
-from unittest.mock import patch
from parameterized import parameterized
from rest_framework import status
@@ -61,12 +60,6 @@ class TestMessageAssets(ClickhouseTestMixin, APIBaseTest):
def setUp(self):
super().setUp()
self.hog_flow = HogFlow.objects.create(team=self.team, name="Test Flow")
- ff_patcher = patch(
- "products.workflows.backend.api.message_assets.posthoganalytics.feature_enabled",
- return_value=True,
- )
- self.feature_enabled_mock = ff_patcher.start()
- self.addCleanup(ff_patcher.stop)
def _base(self) -> str:
return f"/api/projects/{self.team.id}/hog_flows/{self.hog_flow.id}"
@@ -222,30 +215,12 @@ class TestMessageAssets(ClickhouseTestMixin, APIBaseTest):
assert res.status_code == 403, res.json()
assert "person:read" in res.json().get("detail", "")
- @parameterized.expand(
- [
- "assets/",
- "assets/content/?invocation_id=inv-1&action_id=step-a",
- ]
- )
- def test_404_when_ui_flag_disabled(self, path: str):
- self._seed("inv-1", action_id="step-a")
- self.feature_enabled_mock.return_value = False
- res = self.client.get(f"{self._base()}/{path}")
- assert res.status_code == status.HTTP_404_NOT_FOUND
-
class TestPersonEmails(ClickhouseTestMixin, APIBaseTest):
def setUp(self):
super().setUp()
self.person = create_person(team=self.team, distinct_ids=["distinct-1"], properties={"email": "[email protected]"})
self.hog_flow = HogFlow.objects.create(team=self.team, name="Welcome flow")
- ff_patcher = patch(
- "products.workflows.backend.api.message_assets.posthoganalytics.feature_enabled",
- return_value=True,
- )
- self.feature_enabled_mock = ff_patcher.start()
- self.addCleanup(ff_patcher.stop)
def _emails(self, params=None):
return self.client.get(f"/api/projects/{self.team.id}/persons/{self.person.uuid}/emails/", params)
@@ -353,8 +328,3 @@ class TestPersonEmails(ClickhouseTestMixin, APIBaseTest):
)
assert res.status_code == 403, res.json()
assert "person:read" in res.json().get("detail", "")
-
- def test_404_when_ui_flag_disabled(self):
- self._seed("inv-1")
- self.feature_enabled_mock.return_value = False
- assert self._emails().status_code == status.HTTP_404_NOT_FOUND
diff --git a/products/workflows/frontend/Workflows/EmailViewerModal.tsx b/products/workflows/frontend/Workflows/EmailViewerModal.tsx
index 4f398c41a2e8..e40e9d514c01 100644
--- a/products/workflows/frontend/Workflows/EmailViewerModal.tsx
+++ b/products/workflows/frontend/Workflows/EmailViewerModal.tsx
@@ -1,12 +1,8 @@
-import { useValues } from 'kea'
import { useState } from 'react'
import { IconLetter } from '@posthog/icons'
import { LemonModal, Link } from '@posthog/lemon-ui'
-import { FEATURE_FLAGS } from 'lib/constants'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
-
import { HogFlow } from './hogflows/types'
import { getMessageAssetContentUrl } from './messageAssetsApi'
@@ -52,12 +48,8 @@ export function EmailViewerChip({
workflowId: HogFlow['id']
invocationId: string
actionId: string
-}): JSX.Element | null {
- const { featureFlags } = useValues(featureFlagLogic)
+}): JSX.Element {
const [open, setOpen] = useState(false)
- if (!featureFlags[FEATURE_FLAGS.WORKFLOW_EMAIL_ASSETS_UI]) {
- return null
- }
return (
<>
<Link
diff --git a/products/workflows/frontend/Workflows/WorkflowScene.tsx b/products/workflows/frontend/Workflows/WorkflowScene.tsx
index 301e9516951c..6d7844b65371 100644
--- a/products/workflows/frontend/Workflows/WorkflowScene.tsx
+++ b/products/workflows/frontend/Workflows/WorkflowScene.tsx
@@ -8,13 +8,11 @@ import { LemonSwitch, Spinner, SpinnerOverlay } from '@posthog/lemon-ui'
import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'
import { LastSavedIndicator } from 'lib/components/LastSavedIndicator'
import { NotFound } from 'lib/components/NotFound'
-import { FEATURE_FLAGS } from 'lib/constants'
import { useDebouncedValue } from 'lib/hooks/useDebouncedValue'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonTab, LemonTabs } from 'lib/lemon-ui/LemonTabs'
import { LemonTag } from 'lib/lemon-ui/LemonTag/LemonTag'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -50,8 +48,6 @@ export function WorkflowScene(props: WorkflowSceneLogicProps): JSX.Element {
}
const sceneLogic = workflowSceneLogic(workflowSceneProps)
const { currentTab } = useValues(sceneLogic)
- const { featureFlags } = useValues(featureFlagLogic)
- const emailAssetsUIEnabled = !!featureFlags[FEATURE_FLAGS.WORKFLOW_EMAIL_ASSETS_UI]
const { searchParams } = useValues(router)
const templateId = searchParams.templateId as string | undefined
const editTemplateId = searchParams.editTemplateId as string | undefined
@@ -115,17 +111,15 @@ export function WorkflowScene(props: WorkflowSceneLogicProps): JSX.Element {
*/
content: <WorkflowMetrics id={workflowSceneProps.id!} />,
},
- emailAssetsUIEnabled
- ? {
- label: 'Assets',
- key: 'assets',
- /**
- * If we're rendering tabs, props.id is guaranteed to be
- * defined and not "new" (see return statement below)
- */
- content: <WorkflowAssets id={workflowSceneProps.id!} />,
- }
- : null,
+ {
+ label: 'Assets',
+ key: 'assets',
+ /**
+ * If we're rendering tabs, props.id is guaranteed to be
+ * defined and not "new" (see return statement below)
+ */
+ content: <WorkflowAssets id={workflowSceneProps.id!} />,
+ },
{
label: 'History',
key: 'history',