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): add evidence images (#86515)

Arthur Moreira de Deusacacbfa5f74a
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 23035b3d72fa..4c292349cc60 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -5801,9 +5801,9 @@ snapshots:
scenes-app-customer-analytics-dashboard--b-2-c-mode--light:
hash: v1.k794b7964.ff25e11868464e00df352180254dbe0a1017cd1d8c7c4f4c7d6995068e80e2dc.m0XFOZVPCdSaCLaPQ6XTePvkZJ1I11QI2KARZi9QpWs
scenes-app-customer-analytics-dashboard--feature-request-details--dark:
- hash: v1.k794b7964.3b8a1d3f0725f7e80cb22182dbffd2669477fb0d7252e23a2f8600d255089d23.qT77Df8D6q02ZQhcSqw_bdueZW8sycJgDSJoC-t-Vl8
+ hash: v1.k794b7964.dd76e36d821568ab1a8ea103274a39792a5916586913dcc54d4b8c6022aed968.ofepc5cJ-e3ysJbDmjbn2yyefm6X7NwNtnjOfyB4WmA
scenes-app-customer-analytics-dashboard--feature-request-details--light:
- hash: v1.k794b7964.177e3c8ca3cdb3a1cde3fd4f3a53fa980da80c266828666b83f69120e203b2ce.SIQx9fwqD0gfUYUZhn2qfHrCPQCpNw44lP9tnE1j99E
+ hash: v1.k794b7964.8cd0d06dbe8fa12d819f9324d191d3ec9a0741b51acf19ac6490b99aecc1dda7.k0bCKYz1oUdVTINzDzlFA4ZUmefNVOBoQx7Y3KADYxI
scenes-app-customer-analytics-dashboard--feature-requests--dark:
hash: v1.k794b7964.678601de25c8530baa9bd4e94dc67731a7844beae1e6b59a47662824cba7a3e6.EjmdN0pXmKKifMocgNRlncMyliK4qEZlj2AqJ3LhclM
scenes-app-customer-analytics-dashboard--feature-requests--light:
diff --git a/posthog/hogql/database/test/__snapshots__/test_database.ambr b/posthog/hogql/database/test/__snapshots__/test_database.ambr
index 61972649064d..98b289be1906 100644
--- a/posthog/hogql/database/test/__snapshots__/test_database.ambr
+++ b/posthog/hogql/database/test/__snapshots__/test_database.ambr
@@ -7337,6 +7337,16 @@
"table": null,
"type": "date"
},
+ "image_ids": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "image_ids",
+ "id": null,
+ "name": "image_ids",
+ "schema_valid": true,
+ "table": null,
+ "type": "array"
+ },
"created_by_id": {
"chain": null,
"fields": null,
@@ -18239,6 +18249,16 @@
"table": null,
"type": "date"
},
+ "image_ids": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "image_ids",
+ "id": null,
+ "name": "image_ids",
+ "schema_valid": true,
+ "table": null,
+ "type": "array"
+ },
"created_by_id": {
"chain": null,
"fields": null,
diff --git a/products/customer_analytics/backend/facade/contracts.py b/products/customer_analytics/backend/facade/contracts.py
index 312fdd47b4f6..43eaa9261f17 100644
--- a/products/customer_analytics/backend/facade/contracts.py
+++ b/products/customer_analytics/backend/facade/contracts.py
@@ -579,6 +579,7 @@ class FeatureRequestEvidenceView:
evidence_source: str = "conversation"
source_url: str = ""
requested_on: date | None = None
+ image_ids: list[UUID] = field(default_factory=list)
created_by: int | None = None
updated_by: int | None = None
created_at: datetime | None = None
@@ -689,6 +690,7 @@ class FeatureRequestEvidenceInput:
evidence_source: str
source_url: str
requested_on: date | None
+ image_ids: tuple[UUID, ...] = ()
@dataclass(frozen=True)
@@ -707,6 +709,7 @@ class CreateFeatureRequestEvidenceInput:
evidence_source: str
source_url: str
requested_on: date | None
+ image_ids: tuple[UUID, ...] = ()
@dataclass(frozen=True)
@@ -718,6 +721,7 @@ class UpdateFeatureRequestEvidenceInput:
evidence_source: str
source_url: str
requested_on: date | None
+ image_ids: tuple[UUID, ...] | None = None
@dataclass(frozen=True)
diff --git a/products/customer_analytics/backend/facade/hogql.py b/products/customer_analytics/backend/facade/hogql.py
index c0cf94e526d8..0d385f62337a 100644
--- a/products/customer_analytics/backend/facade/hogql.py
+++ b/products/customer_analytics/backend/facade/hogql.py
@@ -806,6 +806,12 @@ feature_request_evidence: PostgresTable = PostgresTable(
"requested_on": DateDatabaseField(
name="requested_on", nullable=True, description="Date the account made the request, or NULL when unknown."
),
+ "_image_ids": StringArrayDatabaseField(name="image_ids", hidden=True),
+ "image_ids": ExpressionField(
+ name="image_ids",
+ expr=parse_expr("arrayMap(image_id -> toString(image_id), _image_ids)"),
+ description="Uploaded image UUIDs attached to this evidence item, in display order.",
+ ),
"created_by_id": IntegerDatabaseField(
name="created_by_id", nullable=True, description="PostHog user who added the evidence."
),
diff --git a/products/customer_analytics/backend/logic/feature_requests.py b/products/customer_analytics/backend/logic/feature_requests.py
index 499fd9f9b117..4632999181c5 100644
--- a/products/customer_analytics/backend/logic/feature_requests.py
+++ b/products/customer_analytics/backend/logic/feature_requests.py
@@ -9,7 +9,7 @@ from django.db.models.functions import Lower
from django.utils import timezone
from posthog.dataclasses import frozen
-from posthog.models import User
+from posthog.models import UploadedMedia, User
from products.customer_analytics.backend.facade import contracts
from products.customer_analytics.backend.models import (
@@ -53,6 +53,7 @@ class _ValidatedEvidence:
customer_quote: str
source: str
source_url: str
+ image_ids: tuple[UUID, ...]
def _to_product_area_view(product_area: FeatureRequestProductArea) -> contracts.FeatureRequestProductAreaView:
@@ -74,6 +75,7 @@ def _to_evidence_view(evidence: FeatureRequestEvidence) -> contracts.FeatureRequ
evidence_source=evidence.source,
source_url=evidence.source_url,
requested_on=evidence.requested_on,
+ image_ids=list(evidence.image_ids),
created_by=evidence.created_by_id,
updated_by=evidence.updated_by_id,
created_at=evidence.created_at,
@@ -340,6 +342,7 @@ def _evidence_snapshot(evidence: FeatureRequestEvidence, *, account: Account | N
"source": evidence.source,
"source_url": evidence.source_url,
"requested_on": evidence.requested_on.isoformat() if evidence.requested_on else None,
+ "image_ids": [str(image_id) for image_id in evidence.image_ids],
}
@@ -790,18 +793,42 @@ def update_feature_request(
)
+def _validate_image_ids(*, team_id: int, image_ids: tuple[UUID, ...]) -> tuple[UUID, ...]:
+ unique_image_ids = tuple(dict.fromkeys(image_ids))
+ valid_image_ids = set(
+ UploadedMedia.objects.filter(
+ team_id=team_id,
+ id__in=unique_image_ids,
+ content_type__startswith="image/",
+ media_location__isnull=False,
+ ).values_list("id", flat=True)
+ )
+ if len(valid_image_ids) != len(unique_image_ids):
+ raise FeatureRequestValidationError("image_ids", "Select images uploaded to this project.")
+ return unique_image_ids
+
+
def _validate_evidence(
+ *,
+ team_id: int,
input: (
contracts.FeatureRequestEvidenceInput
| contracts.CreateFeatureRequestEvidenceInput
| contracts.UpdateFeatureRequestEvidenceInput
),
+ current_image_ids: tuple[UUID, ...] = (),
) -> _ValidatedEvidence:
summary = input.summary.strip()
customer_quote = input.customer_quote.strip()
source_url = input.source_url.strip()
- if not summary and not customer_quote and not source_url:
- raise FeatureRequestValidationError("evidence", "Enter a summary, customer quote, or source URL.")
+ requested_image_ids = input.image_ids
+ image_ids = (
+ current_image_ids
+ if requested_image_ids is None
+ else _validate_image_ids(team_id=team_id, image_ids=requested_image_ids)
+ )
+ if not summary and not customer_quote and not source_url and not image_ids:
+ raise FeatureRequestValidationError("evidence", "Enter a summary, customer quote, source URL, or image.")
if source_url:
parsed_url = urlparse(source_url)
if parsed_url.scheme not in {"http", "https"} or not parsed_url.netloc:
@@ -813,6 +840,7 @@ def _validate_evidence(
customer_quote=customer_quote,
source=input.evidence_source,
source_url=source_url,
+ image_ids=image_ids,
)
@@ -895,7 +923,9 @@ def add_feature_request_account(
user_access_control: "UserAccessControl",
) -> contracts.FeatureRequestView | None:
evidence_input = input.evidence
- validated_evidence = _validate_evidence(evidence_input) if evidence_input is not None else None
+ validated_evidence = (
+ _validate_evidence(team_id=team_id, input=evidence_input) if evidence_input is not None else None
+ )
with transaction.atomic():
feature_request = _get_accessible_feature_request_for_update(
team_id=team_id,
@@ -951,6 +981,7 @@ def add_feature_request_account(
source=validated_evidence.source,
source_url=validated_evidence.source_url,
requested_on=evidence_input.requested_on,
+ image_ids=list(validated_evidence.image_ids),
created_by_id=actor_id,
updated_by_id=actor_id,
)
@@ -982,7 +1013,7 @@ def create_feature_request_evidence(
actor_id: int,
user_access_control: "UserAccessControl",
) -> contracts.FeatureRequestView | None:
- validated_evidence = _validate_evidence(input)
+ validated_evidence = _validate_evidence(team_id=team_id, input=input)
with transaction.atomic():
result = _get_evidence_account_link(
team_id=team_id,
@@ -1002,6 +1033,7 @@ def create_feature_request_evidence(
source=validated_evidence.source,
source_url=validated_evidence.source_url,
requested_on=input.requested_on,
+ image_ids=list(validated_evidence.image_ids),
created_by_id=actor_id,
updated_by_id=actor_id,
)
@@ -1026,7 +1058,6 @@ def update_feature_request_evidence(
actor_id: int,
user_access_control: "UserAccessControl",
) -> contracts.FeatureRequestView | None:
- validated_evidence = _validate_evidence(input)
with transaction.atomic():
evidence = (
FeatureRequestEvidence.objects.for_team(team_id)
@@ -1046,12 +1077,18 @@ def update_feature_request_evidence(
if result is None:
return None
feature_request, account_link = result
+ validated_evidence = _validate_evidence(
+ team_id=team_id,
+ input=input,
+ current_image_ids=tuple(evidence.image_ids),
+ )
before = _evidence_snapshot(evidence, account=account_link.account)
evidence.summary = validated_evidence.summary
evidence.customer_quote = validated_evidence.customer_quote
evidence.source = validated_evidence.source
evidence.source_url = validated_evidence.source_url
evidence.requested_on = input.requested_on
+ evidence.image_ids = list(validated_evidence.image_ids)
after = _evidence_snapshot(evidence, account=account_link.account)
if before != after:
evidence.updated_by_id = actor_id
@@ -1062,6 +1099,7 @@ def update_feature_request_evidence(
"source",
"source_url",
"requested_on",
+ "image_ids",
"updated_by_id",
"updated_at",
]
diff --git a/products/customer_analytics/backend/migrations/0039_feature_request_evidence_images.py b/products/customer_analytics/backend/migrations/0039_feature_request_evidence_images.py
new file mode 100644
index 000000000000..b3ff406f4cee
--- /dev/null
+++ b/products/customer_analytics/backend/migrations/0039_feature_request_evidence_images.py
@@ -0,0 +1,18 @@
+# Generated by Django 5.2.17 on 2026-08-19 20:24
+
+import django.contrib.postgres.fields
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [("customer_analytics", "0038_feature_request_multi_account_evidence")]
+
+ operations = [
+ migrations.AddField(
+ model_name="featurerequestevidence",
+ name="image_ids",
+ field=django.contrib.postgres.fields.ArrayField(
+ base_field=models.UUIDField(), blank=True, default=list, size=None
+ ),
+ ),
+ ]
diff --git a/products/customer_analytics/backend/migrations/max_migration.txt b/products/customer_analytics/backend/migrations/max_migration.txt
index ae0f1270a652..23a7ed7c87a0 100644
--- a/products/customer_analytics/backend/migrations/max_migration.txt
+++ b/products/customer_analytics/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0038_feature_request_multi_account_evidence
+0039_feature_request_evidence_images
diff --git a/products/customer_analytics/backend/models/feature_request.py b/products/customer_analytics/backend/models/feature_request.py
index 3ebfc627c1dc..0c4126f29d56 100644
--- a/products/customer_analytics/backend/models/feature_request.py
+++ b/products/customer_analytics/backend/models/feature_request.py
@@ -1,3 +1,4 @@
+from django.contrib.postgres.fields import ArrayField
from django.db import models
from django.db.models import Q
@@ -153,6 +154,7 @@ class FeatureRequestEvidence(TeamScopedRootMixin, UUIDModel):
source = models.CharField(max_length=200)
source_url = models.URLField(max_length=2000, blank=True, default="")
requested_on = models.DateField(null=True, blank=True)
+ image_ids = ArrayField(models.UUIDField(), default=list, blank=True)
created_by = models.ForeignKey(
"posthog.User",
on_delete=models.SET_NULL,
diff --git a/products/customer_analytics/backend/presentation/views/serializers.py b/products/customer_analytics/backend/presentation/views/serializers.py
index 07f413cc1864..f26677b5df2f 100644
--- a/products/customer_analytics/backend/presentation/views/serializers.py
+++ b/products/customer_analytics/backend/presentation/views/serializers.py
@@ -189,6 +189,11 @@ class FeatureRequestEvidenceSerializer(DataclassSerializer):
allow_null=True,
help_text="Date the account made the request, or null when unknown.",
)
+ image_ids = serializers.ListField(
+ child=serializers.UUIDField(),
+ read_only=True,
+ help_text="Uploaded image IDs attached to this evidence item, in display order.",
+ )
created_by = serializers.IntegerField(
read_only=True, allow_null=True, help_text="ID of the user who added the evidence."
)
@@ -208,6 +213,7 @@ class FeatureRequestEvidenceSerializer(DataclassSerializer):
"evidence_source",
"source_url",
"requested_on",
+ "image_ids",
"created_by",
"updated_by",
"created_at",
@@ -372,6 +378,10 @@ _FEATURE_REQUEST_HISTORY_VALUE_SCHEMA = {
"source": {"type": "string"},
"source_url": {"type": "string"},
"requested_on": {"type": "string", "format": "date", "nullable": True},
+ "image_ids": {
+ "type": "array",
+ "items": {"type": "string", "format": "uuid"},
+ },
},
},
],
@@ -643,6 +653,11 @@ class FeatureRequestEvidencePayloadSerializer(serializers.Serializer):
default=None,
help_text="Date the account made the request, or null when unknown.",
)
+ image_ids = serializers.ListField(
+ required=False,
+ child=serializers.UUIDField(),
+ help_text="Uploaded image IDs from this project to attach in display order.",
+ )
class FeatureRequestEvidenceWriteSerializer(FeatureRequestEvidencePayloadSerializer):
diff --git a/products/customer_analytics/backend/presentation/views/views.py b/products/customer_analytics/backend/presentation/views/views.py
index 126d223ee566..24080d3f88d8 100644
--- a/products/customer_analytics/backend/presentation/views/views.py
+++ b/products/customer_analytics/backend/presentation/views/views.py
@@ -427,6 +427,7 @@ class FeatureRequestViewSet(
evidence_source=evidence_data["evidence_source"],
source_url=evidence_data["source_url"],
requested_on=evidence_data["requested_on"],
+ image_ids=tuple(evidence_data.get("image_ids", ())),
)
if evidence_data is not None
else None
@@ -469,6 +470,7 @@ class FeatureRequestViewSet(
evidence_source=data["evidence_source"],
source_url=data["source_url"],
requested_on=data["requested_on"],
+ image_ids=tuple(data.get("image_ids", ())),
),
actor_id=cast(User, request.user).id,
user_access_control=self.user_access_control,
@@ -499,6 +501,7 @@ class FeatureRequestViewSet(
evidence_source=data["evidence_source"],
source_url=data["source_url"],
requested_on=data["requested_on"],
+ image_ids=tuple(data["image_ids"]) if "image_ids" in request.data else None,
),
actor_id=cast(User, request.user).id,
user_access_control=self.user_access_control,
diff --git a/products/customer_analytics/backend/test/test_facade_hogql.py b/products/customer_analytics/backend/test/test_facade_hogql.py
index b0d6eef10ffd..3e64a6176c91 100644
--- a/products/customer_analytics/backend/test/test_facade_hogql.py
+++ b/products/customer_analytics/backend/test/test_facade_hogql.py
@@ -4,6 +4,8 @@
# in-product: it fails here if a backing table is renamed or a model column is renamed/dropped
# without updating facade/hogql.py, catching the drift on the shard that actually runs for
# model changes.
+from uuid import uuid4
+
from posthog.test.base import NonAtomicBaseTest
from django.test import SimpleTestCase
@@ -102,8 +104,13 @@ class TestFeatureRequestHogqlAccess(NonAtomicBaseTest):
denied_link = FeatureRequestAccountLink.objects.unscoped().create(
team=self.team, feature_request=visible_request, account=denied_account
)
+ visible_image_id = uuid4()
FeatureRequestEvidence.objects.unscoped().create(
- team=self.team, account_link=visible_link, source="conversation", summary="Visible evidence"
+ team=self.team,
+ account_link=visible_link,
+ source="conversation",
+ summary="Visible evidence",
+ image_ids=[visible_image_id],
)
FeatureRequestEvidence.objects.unscoped().create(
team=self.team, account_link=denied_link, source="conversation", summary="Denied evidence"
@@ -140,7 +147,7 @@ class TestFeatureRequestHogqlAccess(NonAtomicBaseTest):
"SELECT id FROM system.feature_request_account_links", team=self.team, user=viewer
).results
evidence = execute_hogql_query(
- "SELECT summary FROM system.feature_request_evidence", team=self.team, user=viewer
+ "SELECT summary, image_ids FROM system.feature_request_evidence", team=self.team, user=viewer
).results
history = execute_hogql_query(
"SELECT changed_fields FROM system.feature_request_history", team=self.team, user=viewer
@@ -148,7 +155,7 @@ class TestFeatureRequestHogqlAccess(NonAtomicBaseTest):
assert {str(row[0]) for row in requests} == {str(visible_request.id)}
assert {str(row[0]) for row in links} == {str(visible_link.id)}
- assert evidence == [("Visible evidence",)]
+ assert evidence == [("Visible evidence", [str(visible_image_id)])]
assert history == [(["evidence"],)]
with self.assertRaises(QueryError):
execute_hogql_query("SELECT changes FROM system.feature_request_history", team=self.team, user=viewer)
diff --git a/products/customer_analytics/backend/test/test_feature_requests.py b/products/customer_analytics/backend/test/test_feature_requests.py
index c7d2df06b258..bae9fba9aaa4 100644
--- a/products/customer_analytics/backend/test/test_feature_requests.py
+++ b/products/customer_analytics/backend/test/test_feature_requests.py
@@ -7,7 +7,7 @@ from unittest.mock import patch
from rest_framework import status
-from posthog.models import OrganizationMembership, Team, User
+from posthog.models import OrganizationMembership, Team, UploadedMedia, User
from posthog.models.organization import AvailableFeature
from posthog.models.scoping import team_scope
@@ -26,6 +26,7 @@ from ee.models.rbac.access_control import AccessControl
class _EvidenceResponse(TypedDict):
id: str
summary: str
+ image_ids: list[str]
class _AccountLinkResponse(TypedDict):
@@ -96,6 +97,7 @@ class TestFeatureRequestsAPI(APIBaseTest):
account_link_id: str,
summary: str,
customer_quote: str = "",
+ image_ids: list[str] | None = None,
) -> _FeatureRequestResponse:
response = self.client.post(
f"{self.requests_url}{request_id}/add_evidence/",
@@ -107,6 +109,7 @@ class TestFeatureRequestsAPI(APIBaseTest):
"evidence_source": "conversation",
"source_url": "",
"requested_on": date.today().isoformat(),
+ "image_ids": image_ids or [],
},
format="json",
)
@@ -624,14 +627,61 @@ class TestFeatureRequestsAPI(APIBaseTest):
["Dated evidence", "Undated evidence"],
)
+ def test_image_only_evidence_requires_images_from_the_same_project(self) -> None:
+ created = self.client.post(self.requests_url, self._payload(), format="json").json()
+ account_link_id = created["account_links"][0]["id"]
+ image = UploadedMedia.objects.create(
+ team=self.team,
+ created_by=self.user,
+ file_name="request.png",
+ content_type="image/png",
+ media_location="feature-requests/request.png",
+ )
+ other_team = Team.objects.create(organization=self.organization)
+ other_image = UploadedMedia.objects.create(
+ team=other_team,
+ created_by=self.user,
+ file_name="other.png",
+ content_type="image/png",
+ media_location="feature-requests/other.png",
+ )
+ add_evidence_url = f"{self.requests_url}{created['id']}/add_evidence/"
+ payload = {
+ "expected_version": created["version"],
+ "account_link_id": account_link_id,
+ "summary": "",
+ "customer_quote": "",
+ "evidence_source": "conversation",
+ "source_url": "",
+ "image_ids": [str(other_image.id)],
+ }
+
+ rejected = self.client.post(add_evidence_url, payload, format="json")
+ payload["image_ids"] = [str(image.id)]
+ accepted = self.client.post(add_evidence_url, payload, format="json")
+
+ self.assertEqual(rejected.status_code, status.HTTP_400_BAD_REQUEST)
+ self.assertEqual(accepted.status_code, status.HTTP_200_OK)
+ self.assertEqual(accepted.json()["account_links"][0]["evidence"][0]["image_ids"], [str(image.id)])
+ history = self.client.get(f"{self.requests_url}{created['id']}/history/").json()
+ self.assertEqual(history[0]["changes"][0]["after"]["image_ids"], [str(image.id)])
+
def test_evidence_updates_and_deletes_with_request_version_checks(self) -> None:
created = self.client.post(self.requests_url, self._payload(), format="json").json()
account_link_id = created["account_links"][0]["id"]
+ image = UploadedMedia.objects.create(
+ team=self.team,
+ created_by=self.user,
+ file_name="request.png",
+ content_type="image/png",
+ media_location="feature-requests/request.png",
+ )
with_evidence = self._add_evidence(
request_id=created["id"],
version=created["version"],
account_link_id=account_link_id,
summary="Initial summary",
+ image_ids=[str(image.id)],
)
evidence_id = with_evidence["account_links"][0]["evidence"][0]["id"]
update_url = f"{self.requests_url}{created['id']}/update_evidence/"
@@ -669,6 +719,7 @@ class TestFeatureRequestsAPI(APIBaseTest):
self.assertEqual(stale.status_code, status.HTTP_409_CONFLICT)
self.assertEqual(updated["account_links"][0]["evidence"][0]["summary"], "Updated summary")
+ self.assertEqual(updated["account_links"][0]["evidence"][0]["image_ids"], [str(image.id)])
self.assertEqual(deleted.status_code, status.HTTP_200_OK)
self.assertEqual(deleted.json()["account_links"][0]["evidence"], [])
self.assertFalse(FeatureRequestEvidence.objects.for_team(self.team.id).filter(id=evidence_id).exists())
diff --git a/products/customer_analytics/frontend/CustomerAnalyticsScene.stories.tsx b/products/customer_analytics/frontend/CustomerAnalyticsScene.stories.tsx
index 65fe197fc7df..146be850acf5 100644
--- a/products/customer_analytics/frontend/CustomerAnalyticsScene.stories.tsx
+++ b/products/customer_analytics/frontend/CustomerAnalyticsScene.stories.tsx
@@ -121,6 +121,7 @@ const featureRequestStoryItem = {
evidence_source: 'conversation',
source_url: '',
requested_on: '2024-01-08',
+ image_ids: ['018f47de-7e12-7000-8000-000000000030'],
created_by: 1,
updated_by: 1,
created_at: '2024-01-12T10:00:00Z',
@@ -133,6 +134,7 @@ const featureRequestStoryItem = {
evidence_source: 'meeting',
source_url: '',
requested_on: `2024-01-${String(index + 9).padStart(2, '0')}`,
+ image_ids: [],
created_by: 1,
updated_by: 1,
created_at: `2024-01-${String(index + 13).padStart(2, '0')}T10:00:00Z`,
@@ -178,6 +180,11 @@ export const FeatureRequests: Story = {
render: () => {
useStorybookMocks({
get: {
+ '/uploaded_media/:id': () =>
+ new Response(
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 360"><rect width="640" height="360" fill="#f0f0eb"/><rect x="80" y="70" width="480" height="220" rx="8" fill="#fff" stroke="#bbb"/><text x="320" y="185" text-anchor="middle" font-family="sans-serif" font-size="24" fill="#444">Retention export preview</text></svg>',
+ { headers: { 'Content-Type': 'image/svg+xml' } }
+ ),
'api/projects/:team_id/feature_requests/': {
count: 1,
next: null,
diff --git a/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestAccountEvidenceModal.tsx b/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestAccountEvidenceModal.tsx
index 4e65b3f29dd7..55d2c01d6184 100644
--- a/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestAccountEvidenceModal.tsx
+++ b/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestAccountEvidenceModal.tsx
@@ -15,18 +15,10 @@ import { dayjs } from 'lib/dayjs'
import { LemonCalendarSelectInput } from 'lib/lemon-ui/LemonCalendar/LemonCalendarSelect'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
+import { FeatureRequestEvidenceImagePicker } from './FeatureRequestEvidenceImagePicker'
+import { FEATURE_REQUEST_EVIDENCE_SOURCE_OPTIONS } from './featureRequestEvidenceOptions'
import { featureRequestsLogic } from './featureRequestsLogic'
-const EVIDENCE_SOURCE_OPTIONS: { value: string; label: string }[] = [
- { value: 'conversation', label: 'Customer conversation' },
- { value: 'slack', label: 'Slack' },
- { value: 'zendesk', label: 'Zendesk' },
- { value: 'email', label: 'Email' },
- { value: 'meeting', label: 'Meeting' },
- { value: 'buildbetter', label: 'BuildBetter' },
- { value: 'other', label: 'Other' },
-]
-
export function FeatureRequestAccountEvidenceModal(): JSX.Element {
const {
evidenceModalOpen,
@@ -43,6 +35,7 @@ export function FeatureRequestAccountEvidenceModal(): JSX.Element {
evidenceRequestedOn,
evidenceError,
savingEvidence,
+ uploadingEvidenceImages,
evidenceSaveDisabledReason,
} = useValues(featureRequestsLogic)
const {
@@ -62,7 +55,11 @@ export function FeatureRequestAccountEvidenceModal(): JSX.Element {
return (
<LemonModal
isOpen={evidenceModalOpen}
- onClose={closeEvidence}
+ onClose={() => {
+ if (!uploadingEvidenceImages) {
+ closeEvidence()
+ }
+ }}
title={addingAccount ? 'Add account and evidence' : editingEvidenceId ? 'Edit evidence' : 'Add evidence'}
width={560}
footer={
@@ -85,12 +82,17 @@ export function FeatureRequestAccountEvidenceModal(): JSX.Element {
})
}
loading={savingEvidence}
+ disabledReason={uploadingEvidenceImages ? 'Uploading images' : undefined}
className="mr-auto"
>
Remove evidence
</LemonButton>
)}
- <LemonButton type="secondary" onClick={closeEvidence}>
+ <LemonButton
+ type="secondary"
+ onClick={closeEvidence}
+ disabledReason={uploadingEvidenceImages ? 'Uploading images' : undefined}
+ >
Cancel
</LemonButton>
<LemonButton
@@ -154,7 +156,7 @@ export function FeatureRequestAccountEvidenceModal(): JSX.Element {
<LemonSelect
value={evidenceSource}
onChange={setEvidenceSource}
- options={EVIDENCE_SOURCE_OPTIONS}
+ options={FEATURE_REQUEST_EVIDENCE_SOURCE_OPTIONS}
fullWidth
/>
</div>
@@ -180,6 +182,7 @@ export function FeatureRequestAccountEvidenceModal(): JSX.Element {
fullWidth
/>
</div>
+ <FeatureRequestEvidenceImagePicker />
</div>
</LemonModal>
)
diff --git a/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestDetail.tsx b/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestDetail.tsx
index d63ef40ebb06..666cf435d729 100644
--- a/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestDetail.tsx
+++ b/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestDetail.tsx
@@ -25,6 +25,7 @@ import { FeatureRequestAccountItem } from './FeatureRequestAccountItem'
import { FeatureRequestDetailSection } from './FeatureRequestDetailSection'
import { FeatureRequestEditModal } from './FeatureRequestEditModal'
import { FeatureRequestHistorySection } from './FeatureRequestHistorySection'
+import { FeatureRequestImages } from './FeatureRequestImages'
import { FeatureRequestPriorityBadge } from './FeatureRequestPriorityBadge'
import { FEATURE_REQUEST_ACCOUNT_PREVIEW_SIZE, featureRequestsLogic } from './featureRequestsLogic'
import { FeatureRequestStatusBadge } from './FeatureRequestStatusBadge'
@@ -35,6 +36,7 @@ export function FeatureRequestDetail({ request }: { request: FeatureRequestApi }
listSearchParams,
activeRequestAccountLinks,
activeRequestEvidenceCount,
+ activeRequestImages,
visibleActiveRequestAccountLinks,
requestAccountsShowingAll,
accountsEvidenceCollapsed,
@@ -46,6 +48,7 @@ export function FeatureRequestDetail({ request }: { request: FeatureRequestApi }
restoreActiveRequest,
setRequestAccountsShowingAll,
setAccountsEvidenceCollapsed,
+ showHistoryTarget,
} = useActions(featureRequestsLogic)
const editorDisabledReason = getAccessControlDisabledReason(
AccessControlResourceType.CustomerAnalytics,
@@ -121,7 +124,7 @@ export function FeatureRequestDetail({ request }: { request: FeatureRequestApi }
)}
<div className="grid grid-cols-1 @5xl:grid-cols-[minmax(0,80ch)_minmax(22rem,1fr)] gap-5">
- <div className="min-w-0">
+ <div className="flex min-w-0 flex-col gap-5">
<FeatureRequestDetailSection icon={<IconDocument />} title="Description">
{request.description ? (
<LemonMarkdown
@@ -134,6 +137,7 @@ export function FeatureRequestDetail({ request }: { request: FeatureRequestApi }
<span className="text-secondary">No description provided.</span>
)}
</FeatureRequestDetailSection>
+ <FeatureRequestImages images={activeRequestImages} onShowEvidence={showHistoryTarget} />
</div>
<aside className="flex flex-col min-w-0 gap-5">
diff --git a/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestEvidenceImagePicker.tsx b/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestEvidenceImagePicker.tsx
new file mode 100644
index 000000000000..d5353deb3bd9
--- /dev/null
+++ b/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestEvidenceImagePicker.tsx
@@ -0,0 +1,73 @@
+import { useActions, useValues } from 'kea'
+
+import { IconImage, IconX } from '@posthog/icons'
+import { LemonButton, LemonFileInput, LemonLabel } from '@posthog/lemon-ui'
+
+import { preflightLogic } from 'lib/logic/preflightLogic'
+import { backendAssetUrl } from 'lib/utils/apiHost'
+
+import { featureRequestsLogic } from './featureRequestsLogic'
+
+export function FeatureRequestEvidenceImagePicker(): JSX.Element {
+ const { objectStorageAvailable } = useValues(preflightLogic)
+ const { evidenceFilesToUpload, evidenceImageIds, uploadingEvidenceImages } = useValues(featureRequestsLogic)
+ const { uploadEvidenceImages, removeEvidenceImage } = useActions(featureRequestsLogic)
+ const uploadDisabledReason = uploadingEvidenceImages
+ ? 'Uploading images'
+ : objectStorageAvailable
+ ? undefined
+ : 'Enable object storage to add images to evidence'
+
+ return (
+ <div className="flex flex-col gap-2">
+ <LemonLabel>Images</LemonLabel>
+ {evidenceImageIds.length > 0 && (
+ <div className="grid grid-cols-2 gap-2 sm:grid-cols-3">
+ {evidenceImageIds.map((imageId) => (
+ <div
+ key={imageId}
+ className="group relative aspect-video overflow-hidden rounded border bg-bg-light"
+ >
+ <img
+ src={backendAssetUrl(`/uploaded_media/${imageId}`)}
+ alt="Evidence attachment"
+ className="h-full w-full object-contain"
+ />
+ <LemonButton
+ type="secondary"
+ status="danger"
+ size="xsmall"
+ icon={<IconX />}
+ onClick={() => removeEvidenceImage(imageId)}
+ aria-label="Remove image"
+ className="absolute right-1 top-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"
+ data-attr="remove-feature-request-evidence-image"
+ />
+ </div>
+ ))}
+ </div>
+ )}
+ <LemonFileInput
+ accept="image/*"
+ multiple
+ onChange={uploadEvidenceImages}
+ loading={uploadingEvidenceImages}
+ value={evidenceFilesToUpload}
+ showUploadedFiles={false}
+ disabledReason={uploadDisabledReason}
+ callToAction={
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconImage />}
+ loading={uploadingEvidenceImages}
+ disabledReason={uploadDisabledReason}
+ data-attr="upload-feature-request-evidence-images"
+ >
+ Add images
+ </LemonButton>
+ }
+ />
+ </div>
+ )
+}
diff --git a/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestEvidenceItem.tsx b/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestEvidenceItem.tsx
index ce544aba91d7..1262abeb6c22 100644
--- a/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestEvidenceItem.tsx
+++ b/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestEvidenceItem.tsx
@@ -1,23 +1,14 @@
import { useActions } from 'kea'
-import { IconPencil } from '@posthog/icons'
+import { IconImage, IconPencil } from '@posthog/icons'
import { LemonButton, LemonCard, Link } from '@posthog/lemon-ui'
import { TZLabel } from 'lib/components/TZLabel'
import type { FeatureRequestAccountLinkApi, FeatureRequestEvidenceApi } from '../../generated/api.schemas'
+import { featureRequestEvidenceSourceLabel } from './featureRequestEvidenceOptions'
import { featureRequestEvidenceElementId, featureRequestsLogic } from './featureRequestsLogic'
-const EVIDENCE_SOURCE_LABELS: Record<string, string> = {
- conversation: 'Customer conversation',
- slack: 'Slack',
- zendesk: 'Zendesk',
- email: 'Email',
- meeting: 'Meeting',
- buildbetter: 'BuildBetter',
- other: 'Other',
-}
-
export function FeatureRequestEvidenceItem({
accountLink,
evidence,
@@ -35,8 +26,11 @@ export function FeatureRequestEvidenceItem({
<div className="flex items-start justify-between gap-2">
<div className="flex min-w-0 flex-col gap-2">
<div className="flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-tertiary">
- <span>{EVIDENCE_SOURCE_LABELS[evidence.evidence_source] ?? evidence.evidence_source}</span>
+ <span>{featureRequestEvidenceSourceLabel(evidence.evidence_source)}</span>
{evidence.requested_on && <span>{evidence.requested_on}</span>}
+ {evidence.image_ids.length > 0 && (
+ <IconImage className="size-3.5" aria-label="Contains images" />
+ )}
{evidence.source_url && (
<Link to={evidence.source_url} target="_blank">
Open source
diff --git a/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestImages.tsx b/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestImages.tsx
new file mode 100644
index 000000000000..3c4184ed338d
--- /dev/null
+++ b/products/customer_analytics/frontend/components/FeatureRequests/FeatureRequestImages.tsx
@@ -0,0 +1,64 @@
+import { IconImage } from '@posthog/icons'
+import { LemonButton, Link } from '@posthog/lemon-ui'
+
+import { backendAssetUrl } from 'lib/utils/apiHost'
+import { urls } from 'scenes/urls'
+
+import { FeatureRequestDetailSection } from './FeatureRequestDetailSection'
+import { featureRequestEvidenceSourceLabel } from './featureRequestEvidenceOptions'
+import type { FeatureRequestImage } from './featureRequestsLogic'
+
+export function FeatureRequestImages({
+ images,
+ onShowEvidence,
+}: {
+ images: FeatureRequestImage[]
+ onShowEvidence: (accountId: string, evidenceId: string) => void
+}): JSX.Element | null {
+ if (images.length === 0) {
+ return null
+ }
+
+ return (
+ <FeatureRequestDetailSection icon={<IconImage />} title="Images">
+ <div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
+ {images.map(({ imageId, account, evidence }) => {
+ const evidenceName = featureRequestEvidenceSourceLabel(evidence.evidence_source)
+ const imageUrl = backendAssetUrl(`/uploaded_media/${imageId}`)
+
+ return (
+ <figure
+ key={`${evidence.id}-${imageId}`}
+ className="m-0 min-w-0 overflow-hidden rounded border"
+ >
+ <Link to={imageUrl} target="_blank" className="block bg-bg-light">
+ <img
+ src={imageUrl}
+ alt={`${account.name} - ${evidenceName}`}
+ className="aspect-video h-full w-full object-contain"
+ />
+ </Link>
+ <figcaption className="flex min-w-0 items-center gap-1.5 border-t px-2 py-1.5 text-xs">
+ <Link to={urls.customerAnalyticsAccount(account.id)} className="truncate">
+ {account.name}
+ </Link>
+ <span className="text-tertiary" aria-hidden>
+ ·
+ </span>
+ <LemonButton
+ type="tertiary"
+ size="xsmall"
+ onClick={() => onShowEvidence(account.id, evidence.id)}
+ className="min-w-0 truncate"
+ data-attr="show-feature-request-image-evidence"
+ >
+ {evidenceName}
+ </LemonButton>
+ </figcaption>
+ </figure>
+ )
+ })}
+ </div>
+ </FeatureRequestDetailSection>
+ )
+}
diff --git a/products/customer_analytics/frontend/components/FeatureRequests/featureRequestEvidenceOptions.ts b/products/customer_analytics/frontend/components/FeatureRequests/featureRequestEvidenceOptions.ts
new file mode 100644
index 000000000000..d292c859ee88
--- /dev/null
+++ b/products/customer_analytics/frontend/components/FeatureRequests/featureRequestEvidenceOptions.ts
@@ -0,0 +1,17 @@
+export const FEATURE_REQUEST_EVIDENCE_SOURCE_OPTIONS: { value: string; label: string }[] = [
+ { value: 'conversation', label: 'Customer conversation' },
+ { value: 'slack', label: 'Slack' },
+ { value: 'zendesk', label: 'Zendesk' },
+ { value: 'email', label: 'Email' },
+ { value: 'meeting', label: 'Meeting' },
+ { value: 'buildbetter', label: 'BuildBetter' },
+ { value: 'other', label: 'Other' },
+]
+
+const FEATURE_REQUEST_EVIDENCE_SOURCE_LABELS = Object.fromEntries(
+ FEATURE_REQUEST_EVIDENCE_SOURCE_OPTIONS.map(({ value, label }) => [value, label])
+)
+
+export function featureRequestEvidenceSourceLabel(source: string): string {
+ return FEATURE_REQUEST_EVIDENCE_SOURCE_LABELS[source] ?? source
+}
diff --git a/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.test.ts b/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.test.ts
index 0dc2164c2769..222c2c33ab49 100644
--- a/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.test.ts
+++ b/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.test.ts
@@ -4,6 +4,7 @@ import { router } from 'kea-router'
import { expectLogic } from 'kea-test-utils'
import { ApiError } from 'lib/api'
+import * as uploadFiles from 'lib/hooks/useUploadFiles'
import { urls } from 'scenes/urls'
import { useMocks } from '~/mocks/jest'
@@ -290,7 +291,48 @@ describe('featureRequestsLogic', () => {
expect(logic.values.editIsStale).toBe(false)
})
- it('adds evidence to the selected account link and refreshes request state', async () => {
+ it('uploads selected evidence images into the draft', async () => {
+ const uploadSpy = jest.spyOn(uploadFiles, 'uploadFile').mockResolvedValue({
+ id: 'image-1',
+ image_location: '/uploaded_media/image-1',
+ name: 'request.png',
+ })
+ const file = new File(['image'], 'request.png', { type: 'image/png' })
+
+ await expectLogic(logic, () => logic.actions.uploadEvidenceImages([file])).toFinishAllListeners()
+
+ expect(uploadSpy).toHaveBeenCalledWith(file)
+ expect(logic.values.evidenceImageIds).toEqual(['image-1'])
+ expect(logic.values.evidenceFilesToUpload).toEqual([])
+ expect(logic.values.uploadingEvidenceImages).toBe(false)
+ })
+
+ it('does not attach an upload to a replacement evidence draft', async () => {
+ let resolveUpload: (image: { id: string; image_location: string; name: string }) => void = () => undefined
+ jest.spyOn(uploadFiles, 'uploadFile').mockReturnValue(
+ new Promise((resolve) => {
+ resolveUpload = resolve
+ })
+ )
+ const file = new File(['image'], 'request.png', { type: 'image/png' })
+ const replacementAccountLink = {
+ ...createdRequest.account_links[0],
+ id: 'account-link-2',
+ account: { id: 'account-2', name: 'Globex' },
+ }
+ logic.actions.openNewEvidence(createdRequest.account_links[0])
+
+ logic.actions.uploadEvidenceImages([file])
+ logic.actions.openNewEvidence(replacementAccountLink)
+ resolveUpload({ id: 'image-1', image_location: '/uploaded_media/image-1', name: file.name })
+ await expectLogic(logic).toFinishAllListeners()
+
+ expect(logic.values.evidenceAccountLinkId).toBe(replacementAccountLink.id)
+ expect(logic.values.evidenceImageIds).toEqual([])
+ expect(logic.values.uploadingEvidenceImages).toBe(false)
+ })
+
+ it('adds image-only evidence and gathers its images for the request', async () => {
const evidenceRequest: FeatureRequestApi = {
...createdRequest,
version: 2,
@@ -300,11 +342,12 @@ describe('featureRequestsLogic', () => {
evidence: [
{
id: 'evidence-1',
- summary: 'Acme needs weekly exports.',
+ summary: '',
customer_quote: '',
evidence_source: 'conversation',
source_url: '',
requested_on: null,
+ image_ids: ['image-1'],
created_by: 1,
updated_by: 1,
created_at: '2026-01-02T00:00:00Z',
@@ -318,20 +361,28 @@ describe('featureRequestsLogic', () => {
await expectLogic(logic, () => logic.actions.setActiveRequestId(createdRequest.id)).toFinishAllListeners()
logic.actions.loadActiveRequestSuccess(createdRequest)
logic.actions.openNewEvidence(createdRequest.account_links[0])
- logic.actions.setEvidenceSummary('Acme needs weekly exports.')
+ logic.actions.evidenceImageUploaded('image-1')
await expectLogic(logic, () => logic.actions.saveEvidence()).toFinishAllListeners()
expect(addSpy).toHaveBeenCalledWith(String(MOCK_DEFAULT_TEAM.id), createdRequest.id, {
expected_version: 1,
account_link_id: 'account-link-1',
- summary: 'Acme needs weekly exports.',
+ summary: '',
customer_quote: '',
evidence_source: 'conversation',
source_url: '',
requested_on: null,
+ image_ids: ['image-1'],
})
expect(logic.values.activeRequest).toEqual(evidenceRequest)
+ expect(logic.values.activeRequestImages).toEqual([
+ {
+ imageId: 'image-1',
+ account: evidenceRequest.account_links[0].account,
+ evidence: evidenceRequest.account_links[0].evidence[0],
+ },
+ ])
expect(logic.values.evidenceModalOpen).toBe(false)
expect(logic.values.savingEvidence).toBe(false)
})
@@ -358,6 +409,7 @@ describe('featureRequestsLogic', () => {
evidence_source: 'meeting',
source_url: '',
requested_on: null,
+ image_ids: [],
created_by: 1,
updated_by: 1,
created_at: '2026-01-03T00:00:00Z',
@@ -392,6 +444,7 @@ describe('featureRequestsLogic', () => {
evidence_source: 'meeting',
source_url: '',
requested_on: null,
+ image_ids: [],
},
})
expect(logic.values.activeRequest).toEqual(updatedRequest)
@@ -406,6 +459,7 @@ describe('featureRequestsLogic', () => {
evidence_source: 'conversation',
source_url: '',
requested_on: '2026-01-03',
+ image_ids: [],
created_by: 1,
updated_by: 1,
created_at: '2026-01-03T00:00:00Z',
diff --git a/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.ts b/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.ts
index 42f6f8fbcc6b..60bb0a67142c 100644
--- a/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.ts
+++ b/products/customer_analytics/frontend/components/FeatureRequests/featureRequestsLogic.ts
@@ -3,6 +3,7 @@ import { loaders } from 'kea-loaders'
import { actionToUrl, router, urlToAction } from 'kea-router'
import { ApiError } from 'lib/api'
+import { uploadFile } from 'lib/hooks/useUploadFiles'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { uuid } from 'lib/utils/dom'
import { teamLogic } from 'scenes/teamLogic'
@@ -50,6 +51,12 @@ import {
export const FEATURE_REQUESTS_PAGE_SIZE = 20
export const FEATURE_REQUEST_ACCOUNT_PREVIEW_SIZE = 5
+export interface FeatureRequestImage {
+ imageId: string
+ account: FeatureRequestAccountApi
+ evidence: FeatureRequestEvidenceApi
+}
+
export function featureRequestAccountElementId(accountId: string): string {
return `feature-request-account-${accountId}`
}
@@ -174,6 +181,7 @@ export interface featureRequestsLogicValues {
activeRequestError: string | null
activeRequestEvidenceCount: number
activeRequestId: string | null
+ activeRequestImages: FeatureRequestImage[]
activeRequestLoading: boolean
addAccountId: string | null
addAccountOptions: {
@@ -204,7 +212,10 @@ export interface featureRequestsLogicValues {
editingEvidenceId: string | null
editingProductAreaId: string | null
evidenceAccountLinkId: string | null
+ evidenceDraftVersion: number
evidenceError: string | null
+ evidenceFilesToUpload: File[]
+ evidenceImageIds: string[]
evidenceModalOpen: boolean
evidenceQuote: string
evidenceRequestedOn: string | null
@@ -254,6 +265,7 @@ export interface featureRequestsLogicValues {
submitDisabledReason: string | undefined
submittingRequest: boolean
title: string
+ uploadingEvidenceImages: boolean
visibleActiveRequestAccountLinks: FeatureRequestAccountLinkApi[]
}
@@ -262,6 +274,9 @@ export interface featureRequestsLogicActions {
archiveActiveRequest: () => {
value: true
}
+ clearEvidenceFilesToUpload: () => {
+ value: true
+ }
clearFilters: () => {
value: true
}
@@ -280,6 +295,9 @@ export interface featureRequestsLogicActions {
closeProductAreas: () => {
value: true
}
+ evidenceImageUploaded: (imageId: string) => {
+ imageId: string
+ }
loadAccounts: (search?: string) => string
loadAccountsFailure: (
error: string,
@@ -383,6 +401,9 @@ export interface featureRequestsLogicActions {
removeEvidence: () => {
value: true
}
+ removeEvidenceImage: (imageId: string) => {
+ imageId: string
+ }
restoreActiveRequest: () => {
value: true
}
@@ -518,6 +539,9 @@ export interface featureRequestsLogicActions {
setTitle: (title: string) => {
title: string
}
+ setUploadingEvidenceImages: (uploadingEvidenceImages: boolean) => {
+ uploadingEvidenceImages: boolean
+ }
showHistoryTarget: (
accountId: string,
evidenceId?: string
@@ -546,6 +570,9 @@ export interface featureRequestsLogicActions {
toggleStatusFilter: (requestStatus: FeatureRequestStatusEnumApi) => {
requestStatus: FeatureRequestStatusEnumApi
}
+ uploadEvidenceImages: (files: File[]) => {
+ files: File[]
+ }
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -581,6 +608,7 @@ export interface featureRequestsLogicMeta {
requestAccountsShowingAll: boolean
) => FeatureRequestAccountLinkApi[]
activeRequestEvidenceCount: (activeRequestAccountLinks: FeatureRequestAccountLinkApi[]) => number
+ activeRequestImages: (activeRequestAccountLinks: FeatureRequestAccountLinkApi[]) => FeatureRequestImage[]
productAreaOptions: (activeProductAreas: FeatureRequestProductAreaApi[]) => {
key: string
label: string
@@ -611,6 +639,8 @@ export interface featureRequestsLogicMeta {
evidenceSummary: string,
evidenceQuote: string,
evidenceUrl: string,
+ evidenceImageIds: string[],
+ uploadingEvidenceImages: boolean,
savingEvidence: boolean
) => string | undefined
productAreaSaveDisabledReason: (productAreaName: string, savingProductArea: boolean) => string | undefined
@@ -714,6 +744,11 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([
setEvidenceUrl: (evidenceUrl: string) => ({ evidenceUrl }),
setEvidenceRequestedOn: (evidenceRequestedOn: string | null) => ({ evidenceRequestedOn }),
setEvidenceError: (evidenceError: string | null) => ({ evidenceError }),
+ uploadEvidenceImages: (files: File[]) => ({ files }),
+ clearEvidenceFilesToUpload: true,
+ evidenceImageUploaded: (imageId: string) => ({ imageId }),
+ removeEvidenceImage: (imageId: string) => ({ imageId }),
+ setUploadingEvidenceImages: (uploadingEvidenceImages: boolean) => ({ uploadingEvidenceImages }),
saveEvidence: true,
removeEvidence: true,
setSavingEvidence: (savingEvidence: boolean) => ({ savingEvidence }),
@@ -1162,6 +1197,42 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([
setEvidenceRequestedOn: (_, { evidenceRequestedOn }) => evidenceRequestedOn,
},
],
+ evidenceDraftVersion: [
+ 0,
+ {
+ openAddAccount: (state) => state + 1,
+ openNewEvidence: (state) => state + 1,
+ openEditEvidence: (state) => state + 1,
+ closeEvidence: (state) => state + 1,
+ setActiveRequestId: (state) => state + 1,
+ },
+ ],
+ evidenceFilesToUpload: [
+ [] as File[],
+ {
+ openAddAccount: () => [],
+ openNewEvidence: () => [],
+ openEditEvidence: () => [],
+ uploadEvidenceImages: (_, { files }) => files,
+ clearEvidenceFilesToUpload: () => [],
+ closeEvidence: () => [],
+ },
+ ],
+ evidenceImageIds: [
+ [] as string[],
+ {
+ openAddAccount: () => [],
+ openNewEvidence: () => [],
+ openEditEvidence: (_, { evidence }) => [...evidence.image_ids],
+ evidenceImageUploaded: (state, { imageId }) => (state.includes(imageId) ? state : [...state, imageId]),
+ removeEvidenceImage: (state, { imageId }) => state.filter((id) => id !== imageId),
+ closeEvidence: () => [],
+ },
+ ],
+ uploadingEvidenceImages: [
+ false,
+ { setUploadingEvidenceImages: (_, { uploadingEvidenceImages }) => uploadingEvidenceImages },
+ ],
evidenceError: [
null as string | null,
{
@@ -1244,6 +1315,19 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([
(accountLinks: FeatureRequestAccountLinkApi[]): number =>
accountLinks.reduce((total, accountLink) => total + accountLink.evidence.length, 0),
],
+ activeRequestImages: [
+ (selectors) => [selectors.activeRequestAccountLinks],
+ (accountLinks: FeatureRequestAccountLinkApi[]): FeatureRequestImage[] =>
+ accountLinks.flatMap((accountLink) =>
+ accountLink.evidence.flatMap((evidence) =>
+ evidence.image_ids.map((imageId) => ({
+ imageId,
+ account: accountLink.account,
+ evidence,
+ }))
+ )
+ ),
+ ],
productAreaOptions: [
(selectors) => [selectors.activeProductAreas],
(productAreas: FeatureRequestProductAreaApi[]): { key: string; label: string }[] =>
@@ -1328,6 +1412,8 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([
selectors.evidenceSummary,
selectors.evidenceQuote,
selectors.evidenceUrl,
+ selectors.evidenceImageIds,
+ selectors.uploadingEvidenceImages,
selectors.savingEvidence,
],
(
@@ -1336,16 +1422,21 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([
summary: string,
quote: string,
sourceUrl: string,
+ imageIds: string[],
+ uploadingImages: boolean,
saving: boolean
): string | undefined => {
+ if (uploadingImages) {
+ return 'Uploading images'
+ }
if (saving) {
return addingAccount ? 'Adding account' : 'Saving evidence'
}
if (addingAccount && !addAccountId) {
return 'Select an account'
}
- if (!addingAccount && !summary.trim() && !quote.trim() && !sourceUrl.trim()) {
- return 'Enter a summary, customer quote, or source URL'
+ if (!addingAccount && !summary.trim() && !quote.trim() && !sourceUrl.trim() && imageIds.length === 0) {
+ return 'Enter a summary, customer quote, source URL, or image'
}
return undefined
},
@@ -1605,6 +1696,27 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([
actions.setEditError("Couldn't load the latest version. Try again.")
}
},
+ uploadEvidenceImages: async ({ files }) => {
+ if (files.length === 0 || values.uploadingEvidenceImages) {
+ return
+ }
+ const evidenceDraftVersion = values.evidenceDraftVersion
+ actions.setUploadingEvidenceImages(true)
+ try {
+ for (const file of files) {
+ const uploadedImage = await uploadFile(file)
+ if (values.evidenceDraftVersion !== evidenceDraftVersion) {
+ return
+ }
+ actions.evidenceImageUploaded(uploadedImage.id)
+ }
+ } catch {
+ lemonToast.error("Couldn't upload one of the images. Try again.")
+ } finally {
+ actions.setUploadingEvidenceImages(false)
+ actions.clearEvidenceFilesToUpload()
+ }
+ },
saveEvidence: async () => {
if (values.evidenceSaveDisabledReason || !values.activeRequest) {
return
@@ -1624,9 +1736,13 @@ export const featureRequestsLogic = kea<featureRequestsLogicType>([
evidence_source: values.evidenceSource,
source_url: values.evidenceUrl.trim(),
requested_on: values.evidenceRequestedOn,
+ image_ids: values.evidenceImageIds,
}
const hasEvidence = Boolean(
- evidenceFields.summary || evidenceFields.customer_quote || evidenceFields.source_url
+ evidenceFields.summary ||
+ evidenceFields.customer_quote ||
+ evidenceFields.source_url ||
+ evidenceFields.image_ids.length
)
let updated: FeatureRequestApi
if (addingAccount && values.addAccountId) {
diff --git a/products/customer_analytics/frontend/generated/api.schemas.ts b/products/customer_analytics/frontend/generated/api.schemas.ts
index abf00cbb33a2..c587465e3ef4 100644
--- a/products/customer_analytics/frontend/generated/api.schemas.ts
+++ b/products/customer_analytics/frontend/generated/api.schemas.ts
@@ -1606,6 +1606,8 @@ export interface FeatureRequestEvidenceApi {
* @nullable
*/
readonly requested_on: string | null
+ /** Uploaded image IDs attached to this evidence item, in display order. */
+ readonly image_ids: readonly string[]
/**
* ID of the user who added the evidence.
* @nullable
@@ -1820,6 +1822,8 @@ export interface FeatureRequestEvidencePayloadApi {
* @nullable
*/
requested_on?: string | null
+ /** Uploaded image IDs from this project to attach in display order. */
+ image_ids?: string[]
}
export interface FeatureRequestAddAccountApi {
@@ -1854,6 +1858,8 @@ export interface FeatureRequestEvidenceCreateApi {
* @nullable
*/
requested_on?: string | null
+ /** Uploaded image IDs from this project to attach in display order. */
+ image_ids?: string[]
/**
* Request version loaded by the editor. Stale versions return 409 Conflict.
* @minimum 1
@@ -1916,6 +1922,7 @@ export type FeatureRequestHistoryChangeApiBefore =
source_url: string
/** @nullable */
requested_on: string | null
+ image_ids?: string[]
}
| null
@@ -1945,6 +1952,7 @@ export type FeatureRequestHistoryChangeApiAfter =
source_url: string
/** @nullable */
requested_on: string | null
+ image_ids?: string[]
}
| null
@@ -2065,6 +2073,8 @@ export interface FeatureRequestEvidenceUpdateApi {
* @nullable
*/
requested_on?: string | null
+ /** Uploaded image IDs from this project to attach in display order. */
+ image_ids?: string[]
/**
* Request version loaded by the editor. Stale versions return 409 Conflict.
* @minimum 1
diff --git a/products/customer_analytics/frontend/generated/api.zod.ts b/products/customer_analytics/frontend/generated/api.zod.ts
index e13f188f29fa..84f8523c2c17 100644
--- a/products/customer_analytics/frontend/generated/api.zod.ts
+++ b/products/customer_analytics/frontend/generated/api.zod.ts
@@ -1119,6 +1119,10 @@ export const FeatureRequestsAddAccountCreateBody = /* @__PURE__ */ zod.object({
.date()
.nullish()
.describe('Date the account made the request, or null when unknown.'),
+ image_ids: zod
+ .array(zod.uuid())
+ .optional()
+ .describe('Uploaded image IDs from this project to attach in display order.'),
}),
zod.null(),
])
@@ -1152,6 +1156,10 @@ export const FeatureRequestsAddEvidenceCreateBody = /* @__PURE__ */ zod.object({
.default(featureRequestsAddEvidenceCreateBodySourceUrlDefault)
.describe('Optional HTTP or HTTPS link to the source.'),
requested_on: zod.iso.date().nullish().describe('Date the account made the request, or null when unknown.'),
+ image_ids: zod
+ .array(zod.uuid())
+ .optional()
+ .describe('Uploaded image IDs from this project to attach in display order.'),
expected_version: zod
.number()
.min(1)
@@ -1207,6 +1215,10 @@ export const FeatureRequestsUpdateEvidenceCreateBody = /* @__PURE__ */ zod.objec
.default(featureRequestsUpdateEvidenceCreateBodySourceUrlDefault)
.describe('Optional HTTP or HTTPS link to the source.'),
requested_on: zod.iso.date().nullish().describe('Date the account made the request, or null when unknown.'),
+ image_ids: zod
+ .array(zod.uuid())
+ .optional()
+ .describe('Uploaded image IDs from this project to attach in display order.'),
expected_version: zod
.number()
.min(1)
diff --git a/products/customer_analytics/mcp/tools.yaml b/products/customer_analytics/mcp/tools.yaml
index ba2726b9d7ff..c627573dc0c9 100644
--- a/products/customer_analytics/mcp/tools.yaml
+++ b/products/customer_analytics/mcp/tools.yaml
@@ -972,8 +972,8 @@ tools:
description: >
Add evidence to an active account link on a Customer analytics feature request. Pass the request `id`, its
current `expected_version`, the `account_link_id`, a free-form `evidence_source`, and at least one of
- `summary`, `customer_quote`, or `source_url`. The response contains the updated request and its next
- version.
+ `summary`, `customer_quote`, `source_url`, or `image_ids`. Image IDs must refer to uploaded images in the
+ current project. The response contains the updated request and its next version.
feature_flag: customer-analytics-feature-requests
feature-requests-archive-create:
operation: feature_requests_archive_create
@@ -1142,8 +1142,9 @@ tools:
description: >
Replace the editable fields of one feature request evidence item. Pass the request `id`, its current
`expected_version`, the `evidence_id`, a free-form `evidence_source`, and the complete values for `summary`,
- `customer_quote`, `source_url`, and `requested_on`. The response contains the updated request and its next
- version.
+ `customer_quote`, `source_url`, and `requested_on`. Pass `image_ids` to replace attached images, or omit it
+ to preserve them. Image IDs must refer to uploaded images in the current project. The response contains the
+ updated request and its next version.
feature_flag: customer-analytics-feature-requests
usage-metrics-create:
operation: groups_types_metrics_create
diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-customer-analytics.md b/products/posthog_ai/skills/querying-posthog-data/references/models-customer-analytics.md
index 73a4e5e7d2dd..c0c94cdc88a5 100644
--- a/products/posthog_ai/skills/querying-posthog-data/references/models-customer-analytics.md
+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-customer-analytics.md
@@ -109,6 +109,7 @@ Column | Type | Nullable | Description
`source` | varchar(200) | NOT NULL | Free-form source name
`source_url` | varchar(2000) | NOT NULL | Source URL or an empty string
`requested_on` | date | NULL | Date the account made the request
+`image_ids` | array(text) | NOT NULL | Uploaded image UUIDs attached to the evidence, in display order
`created_by_id` | integer | NULL | User who added the evidence
`updated_by_id` | integer | NULL | User who last updated the evidence
`created_at` | timestamptz | NOT NULL | When the evidence was added
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 06a1611972ab..7d3ddf34397f 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -4815,7 +4815,7 @@
"feature_flag": "customer-analytics-feature-requests"
},
"feature-requests-add-evidence-create": {
- "description": "Add evidence to an active account link on a Customer analytics feature request. Pass the request `id`, its current `expected_version`, the `account_link_id`, a free-form `evidence_source`, and at least one of `summary`, `customer_quote`, or `source_url`. The response contains the updated request and its next version.",
+ "description": "Add evidence to an active account link on a Customer analytics feature request. Pass the request `id`, its current `expected_version`, the `account_link_id`, a free-form `evidence_source`, and at least one of `summary`, `customer_quote`, `source_url`, or `image_ids`. Image IDs must refer to uploaded images in the current project. The response contains the updated request and its next version.",
"category": "Customer analytics",
"feature": "customer_analytics",
"summary": "Add feature request evidence",
@@ -4965,7 +4965,7 @@
"feature_flag": "customer-analytics-feature-requests"
},
"feature-requests-update-evidence-create": {
- "description": "Replace the editable fields of one feature request evidence item. Pass the request `id`, its current `expected_version`, the `evidence_id`, a free-form `evidence_source`, and the complete values for `summary`, `customer_quote`, `source_url`, and `requested_on`. The response contains the updated request and its next version.",
+ "description": "Replace the editable fields of one feature request evidence item. Pass the request `id`, its current `expected_version`, the `evidence_id`, a free-form `evidence_source`, and the complete values for `summary`, `customer_quote`, `source_url`, and `requested_on`. Pass `image_ids` to replace attached images, or omit it to preserve them. Image IDs must refer to uploaded images in the current project. The response contains the updated request and its next version.",
"category": "Customer analytics",
"feature": "customer_analytics",
"summary": "Update feature request evidence",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index c4a9e599aab9..a5e6c2dfa7c2 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -4970,7 +4970,7 @@
"feature_flag": "customer-analytics-feature-requests"
},
"feature-requests-add-evidence-create": {
- "description": "Add evidence to an active account link on a Customer analytics feature request. Pass the request `id`, its current `expected_version`, the `account_link_id`, a free-form `evidence_source`, and at least one of `summary`, `customer_quote`, or `source_url`. The response contains the updated request and its next version.",
+ "description": "Add evidence to an active account link on a Customer analytics feature request. Pass the request `id`, its current `expected_version`, the `account_link_id`, a free-form `evidence_source`, and at least one of `summary`, `customer_quote`, `source_url`, or `image_ids`. Image IDs must refer to uploaded images in the current project. The response contains the updated request and its next version.",
"category": "Customer analytics",
"feature": "customer_analytics",
"summary": "Add feature request evidence",
@@ -5120,7 +5120,7 @@
"feature_flag": "customer-analytics-feature-requests"
},
"feature-requests-update-evidence-create": {
- "description": "Replace the editable fields of one feature request evidence item. Pass the request `id`, its current `expected_version`, the `evidence_id`, a free-form `evidence_source`, and the complete values for `summary`, `customer_quote`, `source_url`, and `requested_on`. The response contains the updated request and its next version.",
+ "description": "Replace the editable fields of one feature request evidence item. Pass the request `id`, its current `expected_version`, the `evidence_id`, a free-form `evidence_source`, and the complete values for `summary`, `customer_quote`, `source_url`, and `requested_on`. Pass `image_ids` to replace attached images, or omit it to preserve them. Image IDs must refer to uploaded images in the current project. The response contains the updated request and its next version.",
"category": "Customer analytics",
"feature": "customer_analytics",
"summary": "Update feature request evidence",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index e150b2dc8375..1e9113279998 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -37707,6 +37707,8 @@ export namespace Schemas {
* @nullable
*/
readonly requested_on: string | null;
+ /** Uploaded image IDs attached to this evidence item, in display order. */
+ readonly image_ids: readonly string[];
/**
* ID of the user who added the evidence.
* @nullable
@@ -37847,6 +37849,8 @@ export namespace Schemas {
* @nullable
*/
requested_on?: string | null;
+ /** Uploaded image IDs from this project to attach in display order. */
+ image_ids?: string[];
}
export interface FeatureRequestAddAccount {
@@ -37897,6 +37901,8 @@ export namespace Schemas {
* @nullable
*/
requested_on?: string | null;
+ /** Uploaded image IDs from this project to attach in display order. */
+ image_ids?: string[];
/**
* Request version loaded by the editor. Stale versions return 409 Conflict.
* @minimum 1
@@ -37936,6 +37942,8 @@ export namespace Schemas {
* @nullable
*/
requested_on?: string | null;
+ /** Uploaded image IDs from this project to attach in display order. */
+ image_ids?: string[];
/**
* Request version loaded by the editor. Stale versions return 409 Conflict.
* @minimum 1
@@ -37987,6 +37995,7 @@ export namespace Schemas {
source_url: string;
/** @nullable */
requested_on: string | null;
+ image_ids?: string[];
} | null;
/**
@@ -38011,6 +38020,7 @@ export namespace Schemas {
source_url: string;
/** @nullable */
requested_on: string | null;
+ image_ids?: string[];
} | null;
export interface FeatureRequestHistoryChange {
diff --git a/services/mcp/src/generated/customer_analytics/api.ts b/services/mcp/src/generated/customer_analytics/api.ts
index 3ffe31b6f8a1..49464c996c5e 100644
--- a/services/mcp/src/generated/customer_analytics/api.ts
+++ b/services/mcp/src/generated/customer_analytics/api.ts
@@ -1356,6 +1356,10 @@ export const FeatureRequestsAddAccountCreateBody = /* @__PURE__ */ zod.object({
.date()
.nullish()
.describe('Date the account made the request, or null when unknown.'),
+ image_ids: zod
+ .array(zod.string())
+ .optional()
+ .describe('Uploaded image IDs from this project to attach in display order.'),
}),
zod.null(),
])
@@ -1398,6 +1402,10 @@ export const FeatureRequestsAddEvidenceCreateBody = /* @__PURE__ */ zod.object({
.default(featureRequestsAddEvidenceCreateBodySourceUrlDefault)
.describe('Optional HTTP or HTTPS link to the source.'),
requested_on: zod.iso.date().nullish().describe('Date the account made the request, or null when unknown.'),
+ image_ids: zod
+ .array(zod.string())
+ .optional()
+ .describe('Uploaded image IDs from this project to attach in display order.'),
expected_version: zod
.number()
.min(1)
@@ -1507,6 +1515,10 @@ export const FeatureRequestsUpdateEvidenceCreateBody = /* @__PURE__ */ zod.objec
.default(featureRequestsUpdateEvidenceCreateBodySourceUrlDefault)
.describe('Optional HTTP or HTTPS link to the source.'),
requested_on: zod.iso.date().nullish().describe('Date the account made the request, or null when unknown.'),
+ image_ids: zod
+ .array(zod.string())
+ .optional()
+ .describe('Uploaded image IDs from this project to attach in display order.'),
expected_version: zod
.number()
.min(1)
diff --git a/services/mcp/src/tools/generated/customer_analytics.ts b/services/mcp/src/tools/generated/customer_analytics.ts
index e2e75a510fbd..c602437f07fd 100644
--- a/services/mcp/src/tools/generated/customer_analytics.ts
+++ b/services/mcp/src/tools/generated/customer_analytics.ts
@@ -1342,6 +1342,9 @@ const featureRequestsAddEvidenceCreate = (): ToolBase<
if (params.requested_on !== undefined) {
body['requested_on'] = params.requested_on
}
+ if (params.image_ids !== undefined) {
+ body['image_ids'] = params.image_ids
+ }
if (params.expected_version !== undefined) {
body['expected_version'] = params.expected_version
}
@@ -1638,6 +1641,9 @@ const featureRequestsUpdateEvidenceCreate = (): ToolBase<
if (params.requested_on !== undefined) {
body['requested_on'] = params.requested_on
}
+ if (params.image_ids !== undefined) {
+ body['image_ids'] = params.image_ids
+ }
if (params.expected_version !== undefined) {
body['expected_version'] = params.expected_version
}