feat: add send test email for templates and use draft content - #331
feat: add send test email for templates and use draft content#331hanamizuki wants to merge 1 commit into
Conversation
a662b2a to
12d855d
Compare
|
Why did you add parameters for subject, data etc instead of just passing the ID and using the saved values? |
|
Good question — the intent was to let users send a test email while editing, without having to save first. The typical flow when iterating on a template/campaign is: tweak subject/body → check how it looks → tweak again. Requiring a save before every test round means the draft state gets committed to the DB before the user is actually happy with it, which felt a bit awkward for a "preview" action. Passing the current editor values lets the test reflect exactly what's on screen. That said, I totally see the argument for the simpler ID-only approach — it's less surface area on the API and avoids drift between what's saved and what's tested. Happy to go either way:
Let me know which you prefer and I'll adjust. |
0124c85 to
131816a
Compare
540f153 to
5560e7a
Compare
Templates had no way to send a test email — only campaigns did. This adds `POST /templates/:id/test`, mirroring the campaign endpoint: recipients must be project members, the sending domain is verified first, and the subject carries a `[TEST]` prefix. Both the template and the campaign test send now accept optional draft fields (subject, body, from, fromName, replyTo), so the test reflects what is currently in the editor rather than the last saved version. Without that, checking a wording change means saving it first, which is awkward while iterating on copy. The fields are optional and fall back to the stored record, so existing callers are unaffected.
29d7f65 to
9df2ab5
Compare
Summary
Changes
New: Template Send Test Email
apps/api/src/controllers/Templates.ts— newPOST /templates/:id/testendpointapps/api/src/services/TemplateService.ts—sendTest()method with draft content supportapps/web/src/pages/templates/[id].tsx— Send Test button, dialog, and project member selectorFix: Use draft content for test emails
apps/api/src/services/CampaignService.ts— accept optionaldraftparam, use draft fields when presentapps/api/src/controllers/Campaigns.ts— pass draft fields from request body to serviceapps/web/src/pages/campaigns/[id].tsx— send current editor content with test email requestTest plan
🤖 Generated with Claude Code