Send later for drafts
Let users schedule a draft to be sent at a chosen time. Scheduled drafts are stored server-side and sent by the existing job runner, so closing the app does not cancel them.
需要你定 4 项;Codex 里已问过并回答 1 项,已记入账本;2 项是计划写明的默认,不改就保留,可以在下面复核
问题Codex 里已回答n-send-later-entry
Send later entry
Where should users schedule a draft?
默认: Menu next to Send · 不选就是“未作答,保留默认”,不算同意
问题d1
Where is the schedule stored?
默认: column on the drafts table · 不选就是“未作答,保留默认”,不算同意
影响:
src/db/migrations/**src/api/drafts.ts问题d2
What happens if sending fails at the scheduled time?
默认: Retry 3 times with backoff, then mark as failed · 不选就是“未作答,保留默认”,不算同意
影响:
src/jobs/sendScheduled.ts问题d3
Maximum schedule horizon?
默认: 30 days · 不选就是“未作答,保留默认”,不算同意
问题d4
Time zone for the picker
Time zone for the picker: use the user's profile time zone or the device time zone?
无默认,需要你选 · 不选就是“未作答,保留默认”,不算同意
影响:
src/ui/composer/**假设默认,可复核d-drafts-without-recipients-cannot-be
Drafts without recipients cannot be scheduled.
默认: Drafts without recipients cannot be scheduled. · 不选就是“未作答,保留默认”,不算同意
假设默认,可复核d-default-horizon-is-30-days-unless-d3
Default horizon is 30 days unless D3 says otherwise.
默认: Default horizon is 30 days unless D3 says otherwise. · 不选就是“未作答,保留默认”,不算同意
完整计划
Send later for drafts
Summary
Let users schedule a draft to be sent at a chosen time. Scheduled drafts are stored server-side and sent by the existing job runner, so closing the app does not cancel them.
Key Changes
-
Add
scheduled_atto the drafts table and expose it onPATCH /drafts/:id(src/api/drafts.ts). -
New job
send-scheduled-draftsinsrc/jobs/sendScheduled.ts, polled every minute by the job runner. -
Composer gets a "Send later" menu next to Send (
src/ui/composer/SendButton.tsx).
Decisions
-
D1: Where is the schedule stored?
- Option A: column on the drafts table (Recommended)
-
Option B: separate
scheduled_sendstable -
Affects:
src/db/migrations/**,src/api/drafts.ts
-
D2: What happens if sending fails at the scheduled time?
- Retry 3 times with backoff, then mark as failed (Recommended)
- Mark as failed immediately and notify the user
-
Affects:
src/jobs/sendScheduled.ts
-
D3: Maximum schedule horizon?
- 30 days
- 1 year
- Recommended: 30 days
-
D4: Time zone for the picker: use the user's profile time zone or the device time zone?
-
Affects:
src/ui/composer/**
-
Affects:
Test Plan
-
Unit: job picks only drafts with
scheduled_at <= nowand not yet sent. - Integration: schedule, restart the job runner, draft still sends once.
- UI: menu hidden when the draft has no recipients.
Assumptions
- Drafts without recipients cannot be scheduled.
- Default horizon is 30 days unless D3 says otherwise.