:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(actions): credit action edits to the editor in the activity log (#119818)
Kyle Swank57b66c3085ad
diff --git a/products/actions/backend/activity_logging.py b/products/actions/backend/activity_logging.pyindex 2568b2c583d8..b61680998f64 100644--- a/products/actions/backend/activity_logging.py+++ b/products/actions/backend/activity_logging.py@@ -10,7 +10,7 @@ from products.actions.backend.models.action import Action@mutable_receiver(model_activity_signal, sender=Action)def handle_action_change(- sender, scope, before_update, after_update, activity, was_impersonated=False, **kwargs+ sender, scope, before_update, after_update, activity, user=None, was_impersonated=False, **kwargs) -> None:# Detect soft delete/restore by checking the deleted fieldif before_update and after_update:@@ -24,7 +24,7 @@ def handle_action_change(log_activity(organization_id=after_update.team.organization_id,team_id=after_update.team_id,- user=after_update.created_by,+ user=user,was_impersonated=was_impersonated,item_id=after_update.id,scope=scope,diff --git a/products/actions/backend/api/test/test_action.py b/products/actions/backend/api/test/test_action.pyindex 371692cdf13a..f54089855c53 100644--- a/products/actions/backend/api/test/test_action.py+++ b/products/actions/backend/api/test/test_action.py@@ -17,6 +17,7 @@ from rest_framework import statusfrom rest_framework.exceptions import ValidationErrorfrom posthog.models import Tag, User+from posthog.models.activity_logging.activity_log import ActivityLogfrom posthog.test.warehouse_access import WAREHOUSE_ACCESS_CONTROL_FLAG, deny_warehouse_table_to_memberfrom products.actions.backend.api.action import ActionSerializer, ActionStepJSONSerializer@@ -304,6 +305,9 @@ class TestActionApi(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):action.refresh_from_db()assert action.name == "user signed up 2"+ update_log = ActivityLog.objects.get(scope="Action", item_id=str(action.pk), activity="updated")+ assert update_log.user == user+# Assert analytics are sentpatch_capture.assert_called_with(user,