: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
feat(workflows): record who paused a workflow's email (#94120)
Meikel Ratzf56dfb974f48
diff --git a/products/workflows/backend/migrations/0025_hogflow_email_sending_paused_by.py b/products/workflows/backend/migrations/0025_hogflow_email_sending_paused_by.pynew file mode 100644index 000000000000..4ba0013c1553--- /dev/null+++ b/products/workflows/backend/migrations/0025_hogflow_email_sending_paused_by.py@@ -0,0 +1,21 @@+from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("workflows", "0024_hogflow_email_sending_paused_at_and_more"),+ ]++ operations = [+ migrations.AddField(+ model_name="hogflow",+ name="email_sending_paused_by",+ field=models.CharField(+ blank=True,+ choices=[("auto", "auto"), ("staff", "staff")],+ db_default="",+ default="",+ max_length=16,+ ),+ ),+ ]diff --git a/products/workflows/backend/migrations/max_migration.txt b/products/workflows/backend/migrations/max_migration.txtindex 56fa7aa38414..4aa215fa754c 100644--- a/products/workflows/backend/migrations/max_migration.txt+++ b/products/workflows/backend/migrations/max_migration.txt@@ -1 +1 @@-0024_hogflow_email_sending_paused_at_and_more+0025_hogflow_email_sending_paused_bydiff --git a/products/workflows/backend/models/hog_flow/hog_flow.py b/products/workflows/backend/models/hog_flow/hog_flow.pyindex 3f12e713a5d6..9c47602a2d48 100644--- a/products/workflows/backend/models/hog_flow/hog_flow.py+++ b/products/workflows/backend/models/hog_flow/hog_flow.py@@ -171,6 +171,16 @@ class HogFlow(UUIDTModel):# Start bound for every detector window on this workflow. Without it, resuming instantly# re-trips on the feedback that caused the pause in the first place.email_sending_resumed_at = models.DateTimeField(null=True, blank=True)++ class EmailSendingPausedBy(models.TextChoices):+ AUTO = "auto", "auto"+ STAFF = "staff", "staff"++ # Who paused it: "auto" for the deliverability detector, "staff" for a PostHog admin. A staff+ # pause is not customer-resumable, so the resume endpoint refuses it. Empty when not paused.+ email_sending_paused_by = models.CharField(+ max_length=16, blank=True, default="", db_default="", choices=EmailSendingPausedBy.choices+ )# When the deliverability detector last warned this workflow's admins that its rates are# approaching the pause thresholds. Bounds how often the warning email can repeat.email_sending_warned_at = models.DateTimeField(null=True, blank=True)