feat: fix campaign restart dead end (issue #340): resolve preflight tracking senders through the same explicit/tags/all pool the scheduler uses so a connected mailbox is never reported missing, fetch the launch dialog's step count from the steps endpoint instead of a field the campaign API never returns, turn on Keep running for new leads when a form or an automation feeds a campaign (migration 000131 backfills existing ones) and when a member starts a campaign whose every lead has finished so it goes active and waits for leads instead of answering 400, return waiting_for_leads from the start endpoint for the dialog's success screen, and document the no_leads and no_remaining_leads codes and the new behaviour in the campaigns, forms, automations and API docs

This commit is contained in:
Matthew Meszaros
2026-09-07 02:26:50 -07:00
parent 885a7c2aa3
commit 5d60fe9a21
25 changed files with 380 additions and 85 deletions
+7 -1
View File
@@ -391,7 +391,13 @@ func (h *Handler) StartCampaign(c *gin.Context) {
h.auditOrg(c, models.AuditActionStart, models.AuditEntityCampaign, &campaignID, nil, nil)
}
c.JSON(http.StatusOK, gin.H{"status": "started"})
// waiting_for_leads tells the caller the campaign started with nothing to
// send and is active, waiting, so the dashboard can say so at once.
resp := gin.H{"status": "started", "waiting_for_leads": false}
if campaign, gerr := h.CampaignService.Get(c.Request.Context(), orgID.String(), id); gerr == nil && campaign != nil && campaign.IdleSince != nil {
resp["waiting_for_leads"] = true
}
c.JSON(http.StatusOK, resp)
}
// StopCampaign stops a campaign