Email for professionals and teams
Add follow-up reminders for sent mail without a reply
Kevin Kyburz66cb8a78cee0
diff --git a/CLAUDE.md b/CLAUDE.mdindex 86c415a..bad6282 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -127,6 +127,12 @@ The composer's eye toggle (`use-track-opens.ts`, remembered per browser) sends ``analyzeSpam` (`src/lib/spam/engine.ts`) sums scored signals from the analyzers in `src/lib/spam/analyzers/`, contact relationships, per-mailbox reputation and the Bayesian classifier, then applies `SPAM_THRESHOLDS` (`weights.ts`). Authentication is trusted only from the receiving side: verdicts SES computed (the SNS receipt for SES intake, the leading `X-SES-*`/`Authentication-Results: amazonses.com` block for Resend intake, read by `readSesTrace`) ride the queue message as `verdicts`, and otherwise only a Cloudflare-written `Authentication-Results` header counts. `ExternalSpamIntelligenceProvider` adds Spamhaus DQS (ZEN, DBL), abuse.ch URLhaus and RDAP domain age; each lookup is optional, time-limited, cached in memory and under `spam-cache/` in `env.BUCKET` (the Cache API does nothing on workers.dev), and a failure adds no signal. Spamhaus' public mirrors refuse queries from public resolvers such as our DoH endpoint, so only DQS keys work. Keys, the domain-age switch and installation-specific brands live in `app_settings` (admin Spam filter page, `src/lib/spam/settings.ts`), falling back to the `SPAMHAUS_DQS_KEY`, `ABUSECH_AUTH_KEY` and `SPAM_DOMAIN_AGE_CHECK` env vars; reading them tolerates a database without migration 0070. Keep regional brands out of the built-in list in `impersonation.ts`.+### Follow-up reminders surface unanswered sends++The composer's bell (`FollowUpMenu`) sends `followUpDays`; `deliverEmail` arms a `follow_ups` row once the message is actually out, so cancelled undo-sends leave none. The five-minute cron (`runFollowUpReminders` in `src/lib/follow-ups/service.ts`, also in the Node scheduler) moves due rows to `due`, or to `replied` when an inbound message joined the same thread in the same mailbox after the send; listing and reading re-check that, so a late reply closes a reminder too. Due reminders are not inbox rows: `DueFollowUps` pins them above the first inbox page, linking to the Sent message, with snooze and done. Reminders belong to the user who armed them. Before migration 0071 every reader returns nothing and arming is skipped.++Optional tables are detected with `isMissingTableError` (`src/lib/database-errors.ts`): drizzle rethrows driver errors as "Failed query" with the SQLite message on `cause`, so matching `String(error)` misses it.+### Search is an FTS5 index kept by triggers`messages_fts` (migration 0030) is an external-content FTS5 table over `messages`; three triggers in the same migration keep it in sync on insert, update and delete, so no application code touches the index. `buildSearchConditions` in `src/lib/search/conditions.ts` turns the Gmail-style grammar (`src/lib/search/query-utils.ts`) into a `rowid IN (SELECT rowid FROM messages_fts WHERE messages_fts MATCH ?)` predicate plus plain column filters. Two consequences: the bootstrap SQL in `src/lib/setup/migration.ts` is split with `splitSqlStatements`, which keeps trigger bodies whole; and the backup coverage check skips `messages_fts%`, since the shadow tables are derived and repopulate on restore. `wrangler d1 export` does not work on databases with virtual tables; the app's own JSON backup is unaffected.diff --git a/drizzle/migrations/0071_add_follow_ups.sql b/drizzle/migrations/0071_add_follow_ups.sqlnew file mode 100644index 0000000..8c1dc47--- /dev/null+++ b/drizzle/migrations/0071_add_follow_ups.sql@@ -0,0 +1,16 @@+CREATE TABLE `follow_ups` (+ `id` text PRIMARY KEY NOT NULL,+ `message_id` text NOT NULL,+ `user_id` text NOT NULL,+ `due_at` integer NOT NULL,+ `status` text DEFAULT 'pending' NOT NULL,+ `created_at` integer NOT NULL,+ FOREIGN KEY (`message_id`) REFERENCES `messages`(`id`) ON UPDATE no action ON DELETE cascade,+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade+);+--> statement-breakpoint+CREATE UNIQUE INDEX `follow_ups_message_idx` ON `follow_ups` (`message_id`);+--> statement-breakpoint+CREATE INDEX `follow_ups_status_due_idx` ON `follow_ups` (`status`,`due_at`);+--> statement-breakpoint+CREATE INDEX `follow_ups_user_status_idx` ON `follow_ups` (`user_id`,`status`);diff --git a/drizzle/migrations/meta/_journal.json b/drizzle/migrations/meta/_journal.jsonindex 1450e81..b405ba0 100644--- a/drizzle/migrations/meta/_journal.json+++ b/drizzle/migrations/meta/_journal.json@@ -435,6 +435,13 @@"when": 1792836000000,"tag": "0070_add_spam_intelligence_settings","breakpoints": true+ },+ {+ "idx": 63,+ "version": "6",+ "when": 1792837200000,+ "tag": "0071_add_follow_ups",+ "breakpoints": true}]}diff --git a/public/locales/ar.json b/public/locales/ar.jsonindex 06b7e27..736bb81 100644--- a/public/locales/ar.json+++ b/public/locales/ar.json@@ -244,6 +244,22 @@"compose.attachTooltip": "إرفاق ملفات (حتى {max} ميغابايت إجمالًا). تُرسَل الملفات التي تزيد على 3 ميغابايت كروابط تنزيل R2 صالحة لمدة 30 يومًا.","compose.attachFiles": "إرفاق ملفات","compose.trackOpens": "إيصال القراءة",+ "followUp.remindMe": "ذكّرني إن لم يصل رد",+ "followUp.remindOn": "تذكير عند عدم الرد: {when}",+ "followUp.in1Day": "بعد يوم واحد",+ "followUp.in3Days": "بعد 3 أيام",+ "followUp.in1Week": "بعد أسبوع",+ "followUp.none": "بلا تذكير",+ "followUp.scheduledFor": "تذكير في {date} إن لم يصل رد",+ "followUp.noReplyYet": "لا رد بعد. التذكير في البريد الوارد.",+ "followUp.replied": "تم استلام رد",+ "followUp.change": "تغيير",+ "followUp.failed": "تعذّر تحديث التذكير.",+ "followUp.sectionLabel": "بانتظار الرد",+ "followUp.sectionTitle": "لا رد بعد ({count})",+ "followUp.to": "إلى {to}",+ "followUp.remindAgain": "ذكّرني مجددًا",+ "followUp.done": "تم","compose.trackOpensOn": "إيصال القراءة مفعّل: سترى متى تُفتح الرسالة","compose.trackOpensOff": "إيصال القراءة متوقف","compose.deleteDraft": "حذف المسودة",diff --git a/public/locales/bn.json b/public/locales/bn.jsonindex 7a7f9d3..83ce610 100644--- a/public/locales/bn.json+++ b/public/locales/bn.json@@ -228,6 +228,22 @@"compose.attachTooltip": "ফাইল সংযুক্ত করুন (মোট {max} MB পর্যন্ত)। ৩ MB-এর বেশি ফাইল ৩০ দিন মেয়াদি R2 ডাউনলোড লিঙ্ক হিসেবে পাঠানো হয়।","compose.attachFiles": "ফাইল সংযুক্ত করুন","compose.trackOpens": "পঠন রসিদ",+ "followUp.remindMe": "উত্তর না এলে মনে করিয়ে দিন",+ "followUp.remindOn": "উত্তর না এলে রিমাইন্ডার: {when}",+ "followUp.in1Day": "১ দিনে",+ "followUp.in3Days": "৩ দিনে",+ "followUp.in1Week": "১ সপ্তাহে",+ "followUp.none": "কোনো রিমাইন্ডার নেই",+ "followUp.scheduledFor": "{date}-এ রিমাইন্ডার, উত্তর না এলে",+ "followUp.noReplyYet": "এখনও উত্তর আসেনি। রিমাইন্ডার ইনবক্সে আছে।",+ "followUp.replied": "উত্তর পাওয়া গেছে",+ "followUp.change": "পরিবর্তন",+ "followUp.failed": "রিমাইন্ডার আপডেট করা যায়নি।",+ "followUp.sectionLabel": "উত্তরের অপেক্ষায়",+ "followUp.sectionTitle": "এখনও উত্তর নেই ({count})",+ "followUp.to": "প্রতি {to}",+ "followUp.remindAgain": "আবার মনে করিয়ে দিন",+ "followUp.done": "সম্পন্ন","compose.trackOpensOn": "পঠন রসিদ চালু: বার্তাটি কখন খোলা হয়েছে তা দেখতে পাবেন","compose.trackOpensOff": "পঠন রসিদ বন্ধ","compose.deleteDraft": "ড্রাফট মুছুন",diff --git a/public/locales/de.json b/public/locales/de.jsonindex 6a36212..b630ddf 100644--- a/public/locales/de.json+++ b/public/locales/de.json@@ -228,6 +228,22 @@"compose.attachTooltip": "Dateien anhängen (insgesamt bis zu {max} MB). Dateien über 3 MB werden als 30 Tage gültige R2-Download-Links gesendet.","compose.attachFiles": "Dateien anhängen","compose.trackOpens": "Lesebestätigung",+ "followUp.remindMe": "Erinnern, falls keine Antwort",+ "followUp.remindOn": "Erinnerung ohne Antwort: {when}",+ "followUp.in1Day": "In 1 Tag",+ "followUp.in3Days": "In 3 Tagen",+ "followUp.in1Week": "In 1 Woche",+ "followUp.none": "Keine Erinnerung",+ "followUp.scheduledFor": "Erinnerung am {date}, falls keine Antwort kommt",+ "followUp.noReplyYet": "Noch keine Antwort. Die Erinnerung steht im Posteingang.",+ "followUp.replied": "Antwort erhalten",+ "followUp.change": "Ändern",+ "followUp.failed": "Die Erinnerung konnte nicht geändert werden.",+ "followUp.sectionLabel": "Warten auf Antwort",+ "followUp.sectionTitle": "Noch keine Antwort ({count})",+ "followUp.to": "An {to}",+ "followUp.remindAgain": "Erneut erinnern",+ "followUp.done": "Erledigt","compose.trackOpensOn": "Lesebestätigung an: Sie sehen, wann die Nachricht geöffnet wird","compose.trackOpensOff": "Lesebestätigung aus","compose.deleteDraft": "Entwurf löschen",diff --git a/public/locales/es.json b/public/locales/es.jsonindex dc14e09..ca13037 100644--- a/public/locales/es.json+++ b/public/locales/es.json@@ -232,6 +232,22 @@"compose.attachTooltip": "Adjuntar archivos (hasta {max} MB en total). Los archivos de más de 3 MB se envían como enlaces de descarga R2 válidos durante 30 días.","compose.attachFiles": "Adjuntar archivos","compose.trackOpens": "Confirmación de lectura",+ "followUp.remindMe": "Recordarme si no responden",+ "followUp.remindOn": "Recordatorio sin respuesta: {when}",+ "followUp.in1Day": "En 1 día",+ "followUp.in3Days": "En 3 días",+ "followUp.in1Week": "En 1 semana",+ "followUp.none": "Sin recordatorio",+ "followUp.scheduledFor": "Recordatorio el {date} si no responden",+ "followUp.noReplyYet": "Aún sin respuesta. El recordatorio está en la bandeja de entrada.",+ "followUp.replied": "Respuesta recibida",+ "followUp.change": "Cambiar",+ "followUp.failed": "No se pudo actualizar el recordatorio.",+ "followUp.sectionLabel": "Esperando respuesta",+ "followUp.sectionTitle": "Aún sin respuesta ({count})",+ "followUp.to": "Para {to}",+ "followUp.remindAgain": "Recordármelo de nuevo",+ "followUp.done": "Hecho","compose.trackOpensOn": "Confirmación de lectura activada: verás cuándo se abre el mensaje","compose.trackOpensOff": "Confirmación de lectura desactivada","compose.deleteDraft": "Eliminar borrador",diff --git a/public/locales/fa.json b/public/locales/fa.jsonindex 25ed695..7248f7f 100644--- a/public/locales/fa.json+++ b/public/locales/fa.json@@ -228,6 +228,22 @@"compose.attachTooltip": "پیوست فایل (تا مجموع {max} مگابایت). فایلهای بزرگتر از ۳ مگابایت بهصورت پیوندهای دانلود R2 با اعتبار ۳۰ روز ارسال میشوند.","compose.attachFiles": "پیوست فایل","compose.trackOpens": "رسید خواندن",+ "followUp.remindMe": "اگر پاسخی نیامد یادآوری کن",+ "followUp.remindOn": "یادآوری در صورت نبود پاسخ: {when}",+ "followUp.in1Day": "۱ روز دیگر",+ "followUp.in3Days": "۳ روز دیگر",+ "followUp.in1Week": "۱ هفته دیگر",+ "followUp.none": "بدون یادآوری",+ "followUp.scheduledFor": "یادآوری در {date} اگر پاسخی نیامد",+ "followUp.noReplyYet": "هنوز پاسخی نیامده. یادآوری در صندوق ورودی است.",+ "followUp.replied": "پاسخ دریافت شد",+ "followUp.change": "تغییر",+ "followUp.failed": "یادآوری بهروزرسانی نشد.",+ "followUp.sectionLabel": "در انتظار پاسخ",+ "followUp.sectionTitle": "هنوز بدون پاسخ ({count})",+ "followUp.to": "به {to}",+ "followUp.remindAgain": "دوباره یادآوری کن",+ "followUp.done": "انجام شد","compose.trackOpensOn": "رسید خواندن روشن است: میبینید پیام چه زمانی باز شد","compose.trackOpensOff": "رسید خواندن خاموش است","compose.deleteDraft": "حذف پیشنویس",diff --git a/public/locales/fr.json b/public/locales/fr.jsonindex d3696ad..0597bc2 100644--- a/public/locales/fr.json+++ b/public/locales/fr.json@@ -232,6 +232,22 @@"compose.attachTooltip": "Joindre des fichiers (jusqu'à {max} Mo au total). Les fichiers de plus de 3 Mo sont envoyés sous forme de liens de téléchargement R2 valables 30 jours.","compose.attachFiles": "Joindre des fichiers","compose.trackOpens": "Accusé de lecture",+ "followUp.remindMe": "Me le rappeler sans réponse",+ "followUp.remindOn": "Rappel sans réponse : {when}",+ "followUp.in1Day": "Dans 1 jour",+ "followUp.in3Days": "Dans 3 jours",+ "followUp.in1Week": "Dans 1 semaine",+ "followUp.none": "Aucun rappel",+ "followUp.scheduledFor": "Rappel le {date} sans réponse",+ "followUp.noReplyYet": "Pas encore de réponse. Le rappel est dans la boîte de réception.",+ "followUp.replied": "Réponse reçue",+ "followUp.change": "Modifier",+ "followUp.failed": "Impossible de mettre à jour le rappel.",+ "followUp.sectionLabel": "En attente de réponse",+ "followUp.sectionTitle": "Pas encore de réponse ({count})",+ "followUp.to": "À {to}",+ "followUp.remindAgain": "Me le rappeler encore",+ "followUp.done": "Terminé","compose.trackOpensOn": "Accusé de lecture activé : vous verrez quand le message est ouvert","compose.trackOpensOff": "Accusé de lecture désactivé","compose.deleteDraft": "Supprimer le brouillon",diff --git a/public/locales/gu.json b/public/locales/gu.jsonindex a800ccc..ba51aab 100644--- a/public/locales/gu.json+++ b/public/locales/gu.json@@ -228,6 +228,22 @@"compose.attachTooltip": "ફાઇલો જોડો (કુલ {max} MB સુધી). 3 MB થી વધુની ફાઇલો 30 દિવસ માટે માન્ય R2 ડાઉનલોડ લિંક તરીકે મોકલવામાં આવે છે.","compose.attachFiles": "ફાઇલો જોડો","compose.trackOpens": "વાંચન રસીદ",+ "followUp.remindMe": "જવાબ ન આવે તો યાદ અપાવો",+ "followUp.remindOn": "જવાબ ન આવે તો રિમાઇન્ડર: {when}",+ "followUp.in1Day": "1 દિવસમાં",+ "followUp.in3Days": "3 દિવસમાં",+ "followUp.in1Week": "1 અઠવાડિયામાં",+ "followUp.none": "કોઈ રિમાઇન્ડર નહીં",+ "followUp.scheduledFor": "{date} એ રિમાઇન્ડર, જો જવાબ ન આવે",+ "followUp.noReplyYet": "હજી જવાબ નથી આવ્યો. રિમાઇન્ડર ઇનબૉક્સમાં છે.",+ "followUp.replied": "જવાબ મળ્યો",+ "followUp.change": "બદલો",+ "followUp.failed": "રિમાઇન્ડર અપડેટ થઈ શક્યું નહીં.",+ "followUp.sectionLabel": "જવાબની રાહ",+ "followUp.sectionTitle": "હજી જવાબ નથી ({count})",+ "followUp.to": "પ્રતિ {to}",+ "followUp.remindAgain": "ફરી યાદ અપાવો",+ "followUp.done": "થઈ ગયું","compose.trackOpensOn": "વાંચન રસીદ ચાલુ: સંદેશ ક્યારે ખોલાયો તે તમે જોશો","compose.trackOpensOff": "વાંચન રસીદ બંધ","compose.deleteDraft": "ડ્રાફ્ટ કાઢી નાખો",diff --git a/public/locales/ha.json b/public/locales/ha.jsonindex 07c13c6..2d42a48 100644--- a/public/locales/ha.json+++ b/public/locales/ha.json@@ -228,6 +228,22 @@"compose.attachTooltip": "Haɗa fayiloli (har zuwa {max} MB gaba ɗaya). Ana aika fayilolin da suka wuce 3 MB a matsayin hanyoyin sauke R2 masu aiki na kwana 30.","compose.attachFiles": "Haɗa fayiloli","compose.trackOpens": "Rasidin karantawa",+ "followUp.remindMe": "Tunatar da ni idan ba amsa",+ "followUp.remindOn": "Tunatarwa idan ba amsa: {when}",+ "followUp.in1Day": "Cikin kwana 1",+ "followUp.in3Days": "Cikin kwana 3",+ "followUp.in1Week": "Cikin mako 1",+ "followUp.none": "Babu tunatarwa",+ "followUp.scheduledFor": "Tunatarwa a {date} idan ba amsa",+ "followUp.noReplyYet": "Babu amsa tukuna. Tunatarwar tana cikin akwatin saƙo.",+ "followUp.replied": "An sami amsa",+ "followUp.change": "Canza",+ "followUp.failed": "Ba a iya sabunta tunatarwar ba.",+ "followUp.sectionLabel": "Ana jiran amsa",+ "followUp.sectionTitle": "Babu amsa tukuna ({count})",+ "followUp.to": "Zuwa {to}",+ "followUp.remindAgain": "Sake tunatar da ni",+ "followUp.done": "An gama","compose.trackOpensOn": "Rasidin karantawa a kunne: za ku ga lokacin da aka buɗe saƙon","compose.trackOpensOff": "Rasidin karantawa a kashe","compose.deleteDraft": "Share daftari",diff --git a/public/locales/hi.json b/public/locales/hi.jsonindex 3564df3..c53106b 100644--- a/public/locales/hi.json+++ b/public/locales/hi.json@@ -228,6 +228,22 @@"compose.attachTooltip": "फ़ाइलें अटैच करें (कुल {max} MB तक)। 3 MB से बड़ी फ़ाइलें 30 दिन वाले R2 डाउनलोड लिंक के रूप में भेजी जाती हैं।","compose.attachFiles": "फ़ाइलें अटैच करें","compose.trackOpens": "पठन रसीद",+ "followUp.remindMe": "जवाब न आए तो याद दिलाएँ",+ "followUp.remindOn": "जवाब न आने पर रिमाइंडर: {when}",+ "followUp.in1Day": "1 दिन में",+ "followUp.in3Days": "3 दिन में",+ "followUp.in1Week": "1 सप्ताह में",+ "followUp.none": "कोई रिमाइंडर नहीं",+ "followUp.scheduledFor": "{date} को रिमाइंडर, अगर जवाब न आए",+ "followUp.noReplyYet": "अभी तक जवाब नहीं आया। रिमाइंडर इनबॉक्स में है।",+ "followUp.replied": "जवाब मिला",+ "followUp.change": "बदलें",+ "followUp.failed": "रिमाइंडर अपडेट नहीं हो सका।",+ "followUp.sectionLabel": "जवाब की प्रतीक्षा",+ "followUp.sectionTitle": "अभी तक जवाब नहीं ({count})",+ "followUp.to": "प्रति {to}",+ "followUp.remindAgain": "फिर से याद दिलाएँ",+ "followUp.done": "हो गया","compose.trackOpensOn": "पठन रसीद चालू: आप देखेंगे कि संदेश कब खोला गया","compose.trackOpensOff": "पठन रसीद बंद","compose.deleteDraft": "ड्राफ़्ट हटाएँ",diff --git a/public/locales/id.json b/public/locales/id.jsonindex b4b00ae..eb9c0b3 100644--- a/public/locales/id.json+++ b/public/locales/id.json@@ -224,6 +224,22 @@"compose.attachTooltip": "Lampirkan file (total hingga {max} MB). File di atas 3 MB dikirim sebagai tautan unduhan R2 yang berlaku 30 hari.","compose.attachFiles": "Lampirkan file","compose.trackOpens": "Tanda terbaca",+ "followUp.remindMe": "Ingatkan jika tidak dibalas",+ "followUp.remindOn": "Pengingat jika tidak dibalas: {when}",+ "followUp.in1Day": "Dalam 1 hari",+ "followUp.in3Days": "Dalam 3 hari",+ "followUp.in1Week": "Dalam 1 minggu",+ "followUp.none": "Tanpa pengingat",+ "followUp.scheduledFor": "Pengingat pada {date} jika tidak dibalas",+ "followUp.noReplyYet": "Belum ada balasan. Pengingat ada di kotak masuk.",+ "followUp.replied": "Balasan diterima",+ "followUp.change": "Ubah",+ "followUp.failed": "Pengingat tidak dapat diperbarui.",+ "followUp.sectionLabel": "Menunggu balasan",+ "followUp.sectionTitle": "Belum ada balasan ({count})",+ "followUp.to": "Kepada {to}",+ "followUp.remindAgain": "Ingatkan lagi",+ "followUp.done": "Selesai","compose.trackOpensOn": "Tanda terbaca aktif: Anda akan melihat kapan pesan dibuka","compose.trackOpensOff": "Tanda terbaca nonaktif","compose.deleteDraft": "Hapus draf",diff --git a/public/locales/it.json b/public/locales/it.jsonindex bb047ab..ddfe735 100644--- a/public/locales/it.json+++ b/public/locales/it.json@@ -232,6 +232,22 @@"compose.attachTooltip": "Allega file (fino a {max} MB in totale). I file oltre 3 MB vengono inviati come link di download R2 validi 30 giorni.","compose.attachFiles": "Allega file","compose.trackOpens": "Conferma di lettura",+ "followUp.remindMe": "Ricordamelo se non rispondono",+ "followUp.remindOn": "Promemoria senza risposta: {when}",+ "followUp.in1Day": "Tra 1 giorno",+ "followUp.in3Days": "Tra 3 giorni",+ "followUp.in1Week": "Tra 1 settimana",+ "followUp.none": "Nessun promemoria",+ "followUp.scheduledFor": "Promemoria il {date} se non rispondono",+ "followUp.noReplyYet": "Ancora nessuna risposta. Il promemoria è nella posta in arrivo.",+ "followUp.replied": "Risposta ricevuta",+ "followUp.change": "Modifica",+ "followUp.failed": "Impossibile aggiornare il promemoria.",+ "followUp.sectionLabel": "In attesa di risposta",+ "followUp.sectionTitle": "Ancora nessuna risposta ({count})",+ "followUp.to": "A {to}",+ "followUp.remindAgain": "Ricordamelo di nuovo",+ "followUp.done": "Fatto","compose.trackOpensOn": "Conferma di lettura attiva: vedrai quando il messaggio viene aperto","compose.trackOpensOff": "Conferma di lettura disattivata","compose.deleteDraft": "Elimina bozza",diff --git a/public/locales/ja.json b/public/locales/ja.jsonindex 39d6afd..c9a2301 100644--- a/public/locales/ja.json+++ b/public/locales/ja.json@@ -224,6 +224,22 @@"compose.attachTooltip": "ファイルを添付(合計 {max} MB まで)。3 MB を超えるファイルは、30 日間有効な R2 ダウンロードリンクとして送信されます。","compose.attachFiles": "ファイルを添付","compose.trackOpens": "開封確認",+ "followUp.remindMe": "返信がなければリマインド",+ "followUp.remindOn": "返信がない場合のリマインド: {when}",+ "followUp.in1Day": "1日後",+ "followUp.in3Days": "3日後",+ "followUp.in1Week": "1週間後",+ "followUp.none": "リマインドなし",+ "followUp.scheduledFor": "返信がなければ {date} にリマインド",+ "followUp.noReplyYet": "まだ返信がありません。リマインドは受信トレイにあります。",+ "followUp.replied": "返信あり",+ "followUp.change": "変更",+ "followUp.failed": "リマインドを更新できませんでした。",+ "followUp.sectionLabel": "返信待ち",+ "followUp.sectionTitle": "まだ返信なし ({count})",+ "followUp.to": "宛先: {to}",+ "followUp.remindAgain": "もう一度リマインド",+ "followUp.done": "完了","compose.trackOpensOn": "開封確認オン: メッセージが開かれた日時を確認できます","compose.trackOpensOff": "開封確認オフ","compose.deleteDraft": "下書きを削除",diff --git a/public/locales/kn.json b/public/locales/kn.jsonindex 7e9116c..1985695 100644--- a/public/locales/kn.json+++ b/public/locales/kn.json@@ -228,6 +228,22 @@"compose.attachTooltip": "ಫೈಲ್ಗಳನ್ನು ಲಗತ್ತಿಸಿ (ಒಟ್ಟು {max} MB ವರೆಗೆ). 3 MB ಗಿಂತ ದೊಡ್ಡ ಫೈಲ್ಗಳನ್ನು 30 ದಿನಗಳ ಮಾನ್ಯತೆಯ R2 ಡೌನ್ಲೋಡ್ ಲಿಂಕ್ಗಳಾಗಿ ಕಳುಹಿಸಲಾಗುತ್ತದೆ.","compose.attachFiles": "ಫೈಲ್ಗಳನ್ನು ಲಗತ್ತಿಸಿ","compose.trackOpens": "ಓದಿದ ರಸೀದಿ",+ "followUp.remindMe": "ಉತ್ತರ ಬರದಿದ್ದರೆ ನೆನಪಿಸಿ",+ "followUp.remindOn": "ಉತ್ತರ ಬರದಿದ್ದರೆ ಜ್ಞಾಪನೆ: {when}",+ "followUp.in1Day": "1 ದಿನದಲ್ಲಿ",+ "followUp.in3Days": "3 ದಿನಗಳಲ್ಲಿ",+ "followUp.in1Week": "1 ವಾರದಲ್ಲಿ",+ "followUp.none": "ಜ್ಞಾಪನೆ ಇಲ್ಲ",+ "followUp.scheduledFor": "{date} ರಂದು ಜ್ಞಾಪನೆ, ಉತ್ತರ ಬರದಿದ್ದರೆ",+ "followUp.noReplyYet": "ಇನ್ನೂ ಉತ್ತರ ಬಂದಿಲ್ಲ. ಜ್ಞಾಪನೆ ಇನ್ಬಾಕ್ಸ್ನಲ್ಲಿದೆ.",+ "followUp.replied": "ಉತ್ತರ ಬಂದಿದೆ",+ "followUp.change": "ಬದಲಿಸಿ",+ "followUp.failed": "ಜ್ಞಾಪನೆಯನ್ನು ನವೀಕರಿಸಲಾಗಲಿಲ್ಲ.",+ "followUp.sectionLabel": "ಉತ್ತರಕ್ಕಾಗಿ ಕಾಯುತ್ತಿದೆ",+ "followUp.sectionTitle": "ಇನ್ನೂ ಉತ್ತರವಿಲ್ಲ ({count})",+ "followUp.to": "ಗೆ {to}",+ "followUp.remindAgain": "ಮತ್ತೆ ನೆನಪಿಸಿ",+ "followUp.done": "ಮುಗಿದಿದೆ","compose.trackOpensOn": "ಓದಿದ ರಸೀದಿ ಆನ್: ಸಂದೇಶ ಯಾವಾಗ ತೆರೆಯಲಾಯಿತು ಎಂದು ನೀವು ನೋಡುತ್ತೀರಿ","compose.trackOpensOff": "ಓದಿದ ರಸೀದಿ ಆಫ್","compose.deleteDraft": "ಕರಡನ್ನು ಅಳಿಸಿ",diff --git a/public/locales/ko.json b/public/locales/ko.jsonindex fac8099..b13bcd3 100644--- a/public/locales/ko.json+++ b/public/locales/ko.json@@ -228,6 +228,22 @@"compose.attachTooltip": "파일 첨부 (총 {max}MB까지). 3MB를 초과하는 파일은 30일간 유효한 R2 다운로드 링크로 전송됩니다.","compose.attachFiles": "파일 첨부","compose.trackOpens": "읽음 확인",+ "followUp.remindMe": "답장이 없으면 알림",+ "followUp.remindOn": "답장이 없으면 알림: {when}",+ "followUp.in1Day": "1일 후",+ "followUp.in3Days": "3일 후",+ "followUp.in1Week": "1주 후",+ "followUp.none": "알림 없음",+ "followUp.scheduledFor": "답장이 없으면 {date}에 알림",+ "followUp.noReplyYet": "아직 답장이 없습니다. 알림이 받은편지함에 있습니다.",+ "followUp.replied": "답장 받음",+ "followUp.change": "변경",+ "followUp.failed": "알림을 업데이트하지 못했습니다.",+ "followUp.sectionLabel": "답장 대기 중",+ "followUp.sectionTitle": "아직 답장 없음 ({count})",+ "followUp.to": "받는 사람: {to}",+ "followUp.remindAgain": "다시 알림",+ "followUp.done": "완료","compose.trackOpensOn": "읽음 확인 켜짐: 메시지가 열린 시점을 볼 수 있습니다","compose.trackOpensOff": "읽음 확인 꺼짐","compose.deleteDraft": "임시보관 메일 삭제",diff --git a/public/locales/ml.json b/public/locales/ml.jsonindex fe28c88..58624b0 100644--- a/public/locales/ml.json+++ b/public/locales/ml.json@@ -228,6 +228,22 @@"compose.attachTooltip": "ഫയലുകൾ അറ്റാച്ച് ചെയ്യുക (ആകെ {max} MB വരെ). 3 MB ൽ കൂടുതലുള്ള ഫയലുകൾ 30 ദിവസം സാധുവായ R2 ഡൗൺലോഡ് ലിങ്കുകളായി അയയ്ക്കുന്നു.","compose.attachFiles": "ഫയലുകൾ അറ്റാച്ച് ചെയ്യുക","compose.trackOpens": "വായന രസീത്",+ "followUp.remindMe": "മറുപടി ഇല്ലെങ്കിൽ ഓർമ്മിപ്പിക്കുക",+ "followUp.remindOn": "മറുപടി ഇല്ലെങ്കിൽ ഓർമ്മപ്പെടുത്തൽ: {when}",+ "followUp.in1Day": "1 ദിവസത്തിൽ",+ "followUp.in3Days": "3 ദിവസത്തിൽ",+ "followUp.in1Week": "1 ആഴ്ചയിൽ",+ "followUp.none": "ഓർമ്മപ്പെടുത്തൽ ഇല്ല",+ "followUp.scheduledFor": "{date}-ന് ഓർമ്മപ്പെടുത്തൽ, മറുപടി ഇല്ലെങ്കിൽ",+ "followUp.noReplyYet": "ഇതുവരെ മറുപടിയില്ല. ഓർമ്മപ്പെടുത്തൽ ഇൻബോക്സിലുണ്ട്.",+ "followUp.replied": "മറുപടി ലഭിച്ചു",+ "followUp.change": "മാറ്റുക",+ "followUp.failed": "ഓർമ്മപ്പെടുത്തൽ അപ്ഡേറ്റ് ചെയ്യാനായില്ല.",+ "followUp.sectionLabel": "മറുപടിക്കായി കാത്തിരിക്കുന്നു",+ "followUp.sectionTitle": "ഇതുവരെ മറുപടിയില്ല ({count})",+ "followUp.to": "{to}-ലേക്ക്",+ "followUp.remindAgain": "വീണ്ടും ഓർമ്മിപ്പിക്കുക",+ "followUp.done": "പൂർത്തിയായി","compose.trackOpensOn": "വായന രസീത് ഓൺ: സന്ദേശം എപ്പോൾ തുറന്നുവെന്ന് നിങ്ങൾക്ക് കാണാം","compose.trackOpensOff": "വായന രസീത് ഓഫ്","compose.deleteDraft": "കരട് ഇല്ലാതാക്കുക",diff --git a/public/locales/mr.json b/public/locales/mr.jsonindex ad75ea7..18d49ef 100644--- a/public/locales/mr.json+++ b/public/locales/mr.json@@ -228,6 +228,22 @@"compose.attachTooltip": "फाइल्स संलग्न करा (एकूण {max} MB पर्यंत). 3 MB पेक्षा मोठ्या फाइल्स 30 दिवसांच्या R2 डाउनलोड लिंक म्हणून पाठवल्या जातात.","compose.attachFiles": "फाइल्स संलग्न करा","compose.trackOpens": "वाचन पावती",+ "followUp.remindMe": "उत्तर न आल्यास आठवण करा",+ "followUp.remindOn": "उत्तर न आल्यास स्मरणपत्र: {when}",+ "followUp.in1Day": "1 दिवसात",+ "followUp.in3Days": "3 दिवसांत",+ "followUp.in1Week": "1 आठवड्यात",+ "followUp.none": "स्मरणपत्र नाही",+ "followUp.scheduledFor": "{date} रोजी स्मरणपत्र, उत्तर न आल्यास",+ "followUp.noReplyYet": "अद्याप उत्तर नाही. स्मरणपत्र इनबॉक्समध्ये आहे.",+ "followUp.replied": "उत्तर मिळाले",+ "followUp.change": "बदला",+ "followUp.failed": "स्मरणपत्र अपडेट करता आले नाही.",+ "followUp.sectionLabel": "उत्तराची प्रतीक्षा",+ "followUp.sectionTitle": "अद्याप उत्तर नाही ({count})",+ "followUp.to": "प्रति {to}",+ "followUp.remindAgain": "पुन्हा आठवण करा",+ "followUp.done": "पूर्ण","compose.trackOpensOn": "वाचन पावती चालू: संदेश कधी उघडला ते तुम्हाला दिसेल","compose.trackOpensOff": "वाचन पावती बंद","compose.deleteDraft": "मसुदा हटवा",diff --git a/public/locales/ms.json b/public/locales/ms.jsonindex 40ecdf9..44235dd 100644--- a/public/locales/ms.json+++ b/public/locales/ms.json@@ -228,6 +228,22 @@"compose.attachTooltip": "Lampirkan fail (sehingga {max} MB jumlah). Fail melebihi 3 MB dihantar sebagai pautan muat turun R2 yang sah selama 30 hari.","compose.attachFiles": "Lampirkan fail","compose.trackOpens": "Resit baca",+ "followUp.remindMe": "Ingatkan jika tiada balasan",+ "followUp.remindOn": "Peringatan jika tiada balasan: {when}",+ "followUp.in1Day": "Dalam 1 hari",+ "followUp.in3Days": "Dalam 3 hari",+ "followUp.in1Week": "Dalam 1 minggu",+ "followUp.none": "Tiada peringatan",+ "followUp.scheduledFor": "Peringatan pada {date} jika tiada balasan",+ "followUp.noReplyYet": "Belum ada balasan. Peringatan ada dalam peti masuk.",+ "followUp.replied": "Balasan diterima",+ "followUp.change": "Tukar",+ "followUp.failed": "Peringatan tidak dapat dikemas kini.",+ "followUp.sectionLabel": "Menunggu balasan",+ "followUp.sectionTitle": "Belum ada balasan ({count})",+ "followUp.to": "Kepada {to}",+ "followUp.remindAgain": "Ingatkan lagi",+ "followUp.done": "Selesai","compose.trackOpensOn": "Resit baca dihidupkan: anda akan melihat bila mesej dibuka","compose.trackOpensOff": "Resit baca dimatikan","compose.deleteDraft": "Padam draf",diff --git a/public/locales/nl.json b/public/locales/nl.jsonindex 2f39052..012a4a0 100644--- a/public/locales/nl.json+++ b/public/locales/nl.json@@ -228,6 +228,22 @@"compose.attachTooltip": "Bestanden bijvoegen (tot {max} MB in totaal). Bestanden groter dan 3 MB worden verzonden als R2-downloadlinks die 30 dagen geldig zijn.","compose.attachFiles": "Bestanden bijvoegen","compose.trackOpens": "Leesbevestiging",+ "followUp.remindMe": "Herinner me zonder antwoord",+ "followUp.remindOn": "Herinnering zonder antwoord: {when}",+ "followUp.in1Day": "Over 1 dag",+ "followUp.in3Days": "Over 3 dagen",+ "followUp.in1Week": "Over 1 week",+ "followUp.none": "Geen herinnering",+ "followUp.scheduledFor": "Herinnering op {date} zonder antwoord",+ "followUp.noReplyYet": "Nog geen antwoord. De herinnering staat in de inbox.",+ "followUp.replied": "Antwoord ontvangen",+ "followUp.change": "Wijzigen",+ "followUp.failed": "De herinnering kon niet worden bijgewerkt.",+ "followUp.sectionLabel": "Wacht op antwoord",+ "followUp.sectionTitle": "Nog geen antwoord ({count})",+ "followUp.to": "Aan {to}",+ "followUp.remindAgain": "Herinner me opnieuw",+ "followUp.done": "Klaar","compose.trackOpensOn": "Leesbevestiging aan: je ziet wanneer het bericht wordt geopend","compose.trackOpensOff": "Leesbevestiging uit","compose.deleteDraft": "Concept verwijderen",diff --git a/public/locales/pa.json b/public/locales/pa.jsonindex e77c432..1dc6ff5 100644--- a/public/locales/pa.json+++ b/public/locales/pa.json@@ -228,6 +228,22 @@"compose.attachTooltip": "ਫਾਈਲਾਂ ਅਟੈਚ ਕਰੋ (ਕੁੱਲ {max} MB ਤੱਕ)। 3 MB ਤੋਂ ਵੱਡੀਆਂ ਫਾਈਲਾਂ 30 ਦਿਨ ਵੈਧ R2 ਡਾਊਨਲੋਡ ਲਿੰਕਾਂ ਵਜੋਂ ਭੇਜੀਆਂ ਜਾਂਦੀਆਂ ਹਨ।","compose.attachFiles": "ਫਾਈਲਾਂ ਅਟੈਚ ਕਰੋ","compose.trackOpens": "ਪੜ੍ਹਨ ਦੀ ਰਸੀਦ",+ "followUp.remindMe": "ਜਵਾਬ ਨਾ ਆਵੇ ਤਾਂ ਯਾਦ ਕਰਾਓ",+ "followUp.remindOn": "ਜਵਾਬ ਨਾ ਆਉਣ 'ਤੇ ਰੀਮਾਈਂਡਰ: {when}",+ "followUp.in1Day": "1 ਦਿਨ ਵਿੱਚ",+ "followUp.in3Days": "3 ਦਿਨਾਂ ਵਿੱਚ",+ "followUp.in1Week": "1 ਹਫ਼ਤੇ ਵਿੱਚ",+ "followUp.none": "ਕੋਈ ਰੀਮਾਈਂਡਰ ਨਹੀਂ",+ "followUp.scheduledFor": "{date} ਨੂੰ ਰੀਮਾਈਂਡਰ, ਜੇ ਜਵਾਬ ਨਾ ਆਵੇ",+ "followUp.noReplyYet": "ਅਜੇ ਜਵਾਬ ਨਹੀਂ ਆਇਆ। ਰੀਮਾਈਂਡਰ ਇਨਬਾਕਸ ਵਿੱਚ ਹੈ।",+ "followUp.replied": "ਜਵਾਬ ਮਿਲਿਆ",+ "followUp.change": "ਬਦਲੋ",+ "followUp.failed": "ਰੀਮਾਈਂਡਰ ਅੱਪਡੇਟ ਨਹੀਂ ਹੋ ਸਕਿਆ।",+ "followUp.sectionLabel": "ਜਵਾਬ ਦੀ ਉਡੀਕ",+ "followUp.sectionTitle": "ਅਜੇ ਜਵਾਬ ਨਹੀਂ ({count})",+ "followUp.to": "ਨੂੰ {to}",+ "followUp.remindAgain": "ਦੁਬਾਰਾ ਯਾਦ ਕਰਾਓ",+ "followUp.done": "ਹੋ ਗਿਆ","compose.trackOpensOn": "ਪੜ੍ਹਨ ਦੀ ਰਸੀਦ ਚਾਲੂ: ਤੁਸੀਂ ਦੇਖੋਗੇ ਕਿ ਸੁਨੇਹਾ ਕਦੋਂ ਖੋਲ੍ਹਿਆ ਗਿਆ","compose.trackOpensOff": "ਪੜ੍ਹਨ ਦੀ ਰਸੀਦ ਬੰਦ","compose.deleteDraft": "ਡਰਾਫਟ ਮਿਟਾਓ",diff --git a/public/locales/pl.json b/public/locales/pl.jsonindex 04cc61f..e6f8f62 100644--- a/public/locales/pl.json+++ b/public/locales/pl.json@@ -236,6 +236,22 @@"compose.attachTooltip": "Dołącz pliki (łącznie do {max} MB). Pliki powyżej 3 MB są wysyłane jako linki do pobrania z R2 ważne 30 dni.","compose.attachFiles": "Dołącz pliki","compose.trackOpens": "Potwierdzenie odczytu",+ "followUp.remindMe": "Przypomnij, jeśli brak odpowiedzi",+ "followUp.remindOn": "Przypomnienie bez odpowiedzi: {when}",+ "followUp.in1Day": "Za 1 dzień",+ "followUp.in3Days": "Za 3 dni",+ "followUp.in1Week": "Za 1 tydzień",+ "followUp.none": "Bez przypomnienia",+ "followUp.scheduledFor": "Przypomnienie {date}, jeśli brak odpowiedzi",+ "followUp.noReplyYet": "Jeszcze brak odpowiedzi. Przypomnienie jest w skrzynce odbiorczej.",+ "followUp.replied": "Otrzymano odpowiedź",+ "followUp.change": "Zmień",+ "followUp.failed": "Nie udało się zaktualizować przypomnienia.",+ "followUp.sectionLabel": "Oczekiwanie na odpowiedź",+ "followUp.sectionTitle": "Jeszcze brak odpowiedzi ({count})",+ "followUp.to": "Do {to}",+ "followUp.remindAgain": "Przypomnij ponownie",+ "followUp.done": "Gotowe","compose.trackOpensOn": "Potwierdzenie odczytu włączone: zobaczysz, kiedy wiadomość zostanie otwarta","compose.trackOpensOff": "Potwierdzenie odczytu wyłączone","compose.deleteDraft": "Usuń wersję roboczą",diff --git a/public/locales/pt-BR.json b/public/locales/pt-BR.jsonindex 6b15089..978314e 100644--- a/public/locales/pt-BR.json+++ b/public/locales/pt-BR.json@@ -232,6 +232,22 @@"compose.attachTooltip": "Anexar arquivos (até {max} MB no total). Arquivos acima de 3 MB são enviados como links de download R2 válidos por 30 dias.","compose.attachFiles": "Anexar arquivos","compose.trackOpens": "Confirmação de leitura",+ "followUp.remindMe": "Lembrar se não responderem",+ "followUp.remindOn": "Lembrete sem resposta: {when}",+ "followUp.in1Day": "Em 1 dia",+ "followUp.in3Days": "Em 3 dias",+ "followUp.in1Week": "Em 1 semana",+ "followUp.none": "Sem lembrete",+ "followUp.scheduledFor": "Lembrete em {date} se não responderem",+ "followUp.noReplyYet": "Ainda sem resposta. O lembrete está na caixa de entrada.",+ "followUp.replied": "Resposta recebida",+ "followUp.change": "Alterar",+ "followUp.failed": "Não foi possível atualizar o lembrete.",+ "followUp.sectionLabel": "Aguardando resposta",+ "followUp.sectionTitle": "Ainda sem resposta ({count})",+ "followUp.to": "Para {to}",+ "followUp.remindAgain": "Lembrar de novo",+ "followUp.done": "Concluído","compose.trackOpensOn": "Confirmação de leitura ativada: você verá quando a mensagem for aberta","compose.trackOpensOff": "Confirmação de leitura desativada","compose.deleteDraft": "Excluir rascunho",diff --git a/public/locales/pt-PT.json b/public/locales/pt-PT.jsonindex eeabfcc..8294afc 100644--- a/public/locales/pt-PT.json+++ b/public/locales/pt-PT.json@@ -232,6 +232,22 @@"compose.attachTooltip": "Anexar ficheiros (até {max} MB no total). Ficheiros acima de 3 MB são enviados como links de download R2 válidos por 30 dias.","compose.attachFiles": "Anexar ficheiros","compose.trackOpens": "Confirmação de leitura",+ "followUp.remindMe": "Lembrar se não responderem",+ "followUp.remindOn": "Lembrete sem resposta: {when}",+ "followUp.in1Day": "Daqui a 1 dia",+ "followUp.in3Days": "Daqui a 3 dias",+ "followUp.in1Week": "Daqui a 1 semana",+ "followUp.none": "Sem lembrete",+ "followUp.scheduledFor": "Lembrete a {date} se não responderem",+ "followUp.noReplyYet": "Ainda sem resposta. O lembrete está na caixa de entrada.",+ "followUp.replied": "Resposta recebida",+ "followUp.change": "Alterar",+ "followUp.failed": "Não foi possível atualizar o lembrete.",+ "followUp.sectionLabel": "A aguardar resposta",+ "followUp.sectionTitle": "Ainda sem resposta ({count})",+ "followUp.to": "Para {to}",+ "followUp.remindAgain": "Lembrar novamente",+ "followUp.done": "Concluído","compose.trackOpensOn": "Confirmação de leitura ativada: verá quando a mensagem for aberta","compose.trackOpensOff": "Confirmação de leitura desativada","compose.deleteDraft": "Eliminar rascunho",diff --git a/public/locales/ru.json b/public/locales/ru.jsonindex 064a656..2264694 100644--- a/public/locales/ru.json+++ b/public/locales/ru.json@@ -236,6 +236,22 @@"compose.attachTooltip": "Прикрепить файлы (всего до {max} МБ). Файлы размером более 3 МБ отправляются в виде ссылок для скачивания R2, действующих 30 дней.","compose.attachFiles": "Прикрепить файлы","compose.trackOpens": "Отслеживание прочтения",+ "followUp.remindMe": "Напомнить, если нет ответа",+ "followUp.remindOn": "Напоминание без ответа: {when}",+ "followUp.in1Day": "Через 1 день",+ "followUp.in3Days": "Через 3 дня",+ "followUp.in1Week": "Через 1 неделю",+ "followUp.none": "Без напоминания",+ "followUp.scheduledFor": "Напоминание {date}, если нет ответа",+ "followUp.noReplyYet": "Ответа пока нет. Напоминание во входящих.",+ "followUp.replied": "Ответ получен",+ "followUp.change": "Изменить",+ "followUp.failed": "Не удалось обновить напоминание.",+ "followUp.sectionLabel": "Ожидают ответа",+ "followUp.sectionTitle": "Пока без ответа ({count})",+ "followUp.to": "Кому: {to}",+ "followUp.remindAgain": "Напомнить ещё раз",+ "followUp.done": "Готово","compose.trackOpensOn": "Отслеживание включено: вы увидите, когда письмо откроют","compose.trackOpensOff": "Отслеживание выключено","compose.deleteDraft": "Удалить черновик",diff --git a/public/locales/si.json b/public/locales/si.jsonindex ef26750..d9cc05f 100644--- a/public/locales/si.json+++ b/public/locales/si.json@@ -228,6 +228,22 @@"compose.attachTooltip": "ගොනු අමුණන්න (මුළු {max} MB දක්වා). 3 MB ට වැඩි ගොනු දින 30ක බාගැනීම් සබැඳි ලෙස යවනු ලැබේ.","compose.attachFiles": "ගොනු අමුණන්න","compose.trackOpens": "කියවූ බවට රිසිට්පත",+ "followUp.remindMe": "පිළිතුරක් නැත්නම් මතක් කරන්න",+ "followUp.remindOn": "පිළිතුරක් නැත්නම් සිහිකැඳවීම: {when}",+ "followUp.in1Day": "දින 1කින්",+ "followUp.in3Days": "දින 3කින්",+ "followUp.in1Week": "සති 1කින්",+ "followUp.none": "සිහිකැඳවීමක් නැත",+ "followUp.scheduledFor": "{date} දින සිහිකැඳවීම, පිළිතුරක් නැත්නම්",+ "followUp.noReplyYet": "තවම පිළිතුරක් නැත. සිහිකැඳවීම එන ලිපි තුළ ඇත.",+ "followUp.replied": "පිළිතුර ලැබුණි",+ "followUp.change": "වෙනස් කරන්න",+ "followUp.failed": "සිහිකැඳවීම යාවත්කාලීන කළ නොහැකි විය.",+ "followUp.sectionLabel": "පිළිතුරක් බලාපොරොත්තුවෙන්",+ "followUp.sectionTitle": "තවම පිළිතුරක් නැත ({count})",+ "followUp.to": "{to} වෙත",+ "followUp.remindAgain": "නැවත මතක් කරන්න",+ "followUp.done": "නිමයි","compose.trackOpensOn": "කියවූ බවට රිසිට්පත ක්රියාත්මකයි: පණිවිඩය විවෘත කළ විට ඔබට පෙනේ","compose.trackOpensOff": "කියවූ බවට රිසිට්පත අක්රියයි","compose.deleteDraft": "කෙටුම්පත මකන්න",diff --git a/public/locales/sw.json b/public/locales/sw.jsonindex 55c1ee2..e694f54 100644--- a/public/locales/sw.json+++ b/public/locales/sw.json@@ -228,6 +228,22 @@"compose.attachTooltip": "Ambatisha faili (hadi MB {max} kwa jumla). Faili zinazozidi MB 3 hutumwa kama viungo vya kupakua vya R2 vinavyodumu siku 30.","compose.attachFiles": "Ambatisha faili","compose.trackOpens": "Risiti ya kusoma",+ "followUp.remindMe": "Nikumbushe ikiwa hakuna jibu",+ "followUp.remindOn": "Kikumbusho bila jibu: {when}",+ "followUp.in1Day": "Baada ya siku 1",+ "followUp.in3Days": "Baada ya siku 3",+ "followUp.in1Week": "Baada ya wiki 1",+ "followUp.none": "Hakuna kikumbusho",+ "followUp.scheduledFor": "Kikumbusho tarehe {date} ikiwa hakuna jibu",+ "followUp.noReplyYet": "Bado hakuna jibu. Kikumbusho kiko kwenye kikasha.",+ "followUp.replied": "Jibu limepokelewa",+ "followUp.change": "Badilisha",+ "followUp.failed": "Imeshindikana kusasisha kikumbusho.",+ "followUp.sectionLabel": "Inasubiri jibu",+ "followUp.sectionTitle": "Bado hakuna jibu ({count})",+ "followUp.to": "Kwa {to}",+ "followUp.remindAgain": "Nikumbushe tena",+ "followUp.done": "Imekamilika","compose.trackOpensOn": "Risiti ya kusoma imewashwa: utaona ujumbe ulipofunguliwa","compose.trackOpensOff": "Risiti ya kusoma imezimwa","compose.deleteDraft": "Futa rasimu",diff --git a/public/locales/ta.json b/public/locales/ta.jsonindex 65b72df..a0f93c2 100644--- a/public/locales/ta.json+++ b/public/locales/ta.json@@ -228,6 +228,22 @@"compose.attachTooltip": "கோப்புகளை இணை (மொத்தம் {max} MB வரை). 3 MB க்கு மேற்பட்ட கோப்புகள் 30 நாட்கள் செல்லுபடியாகும் R2 பதிவிறக்க இணைப்புகளாக அனுப்பப்படும்.","compose.attachFiles": "கோப்புகளை இணை","compose.trackOpens": "படித்த ரசீது",+ "followUp.remindMe": "பதில் வராவிட்டால் நினைவூட்டு",+ "followUp.remindOn": "பதில் வராவிட்டால் நினைவூட்டல்: {when}",+ "followUp.in1Day": "1 நாளில்",+ "followUp.in3Days": "3 நாட்களில்",+ "followUp.in1Week": "1 வாரத்தில்",+ "followUp.none": "நினைவூட்டல் இல்லை",+ "followUp.scheduledFor": "{date} அன்று நினைவூட்டல், பதில் வராவிட்டால்",+ "followUp.noReplyYet": "இன்னும் பதில் இல்லை. நினைவூட்டல் இன்பாக்ஸில் உள்ளது.",+ "followUp.replied": "பதில் வந்தது",+ "followUp.change": "மாற்று",+ "followUp.failed": "நினைவூட்டலைப் புதுப்பிக்க முடியவில்லை.",+ "followUp.sectionLabel": "பதிலுக்காகக் காத்திருக்கிறது",+ "followUp.sectionTitle": "இன்னும் பதில் இல்லை ({count})",+ "followUp.to": "{to} க்கு",+ "followUp.remindAgain": "மீண்டும் நினைவூட்டு",+ "followUp.done": "முடிந்தது","compose.trackOpensOn": "படித்த ரசீது இயக்கத்தில்: செய்தி எப்போது திறக்கப்பட்டது என்பதைப் பார்ப்பீர்கள்","compose.trackOpensOff": "படித்த ரசீது முடக்கத்தில்","compose.deleteDraft": "வரைவை நீக்கு",diff --git a/public/locales/te.json b/public/locales/te.jsonindex 02ce84d..29da517 100644--- a/public/locales/te.json+++ b/public/locales/te.json@@ -228,6 +228,22 @@"compose.attachTooltip": "ఫైళ్లను అటాచ్ చేయండి (మొత్తం {max} MB వరకు). 3 MB కంటే పెద్ద ఫైళ్లు 30 రోజుల R2 డౌన్లోడ్ లింక్లుగా పంపబడతాయి.","compose.attachFiles": "ఫైళ్లను అటాచ్ చేయండి","compose.trackOpens": "చదివిన రసీదు",+ "followUp.remindMe": "సమాధానం రాకపోతే గుర్తు చేయి",+ "followUp.remindOn": "సమాధానం రాకపోతే రిమైండర్: {when}",+ "followUp.in1Day": "1 రోజులో",+ "followUp.in3Days": "3 రోజుల్లో",+ "followUp.in1Week": "1 వారంలో",+ "followUp.none": "రిమైండర్ లేదు",+ "followUp.scheduledFor": "{date} న రిమైండర్, సమాధానం రాకపోతే",+ "followUp.noReplyYet": "ఇంకా సమాధానం రాలేదు. రిమైండర్ ఇన్బాక్స్లో ఉంది.",+ "followUp.replied": "సమాధానం వచ్చింది",+ "followUp.change": "మార్చు",+ "followUp.failed": "రిమైండర్ను అప్డేట్ చేయలేకపోయాం.",+ "followUp.sectionLabel": "సమాధానం కోసం వేచి ఉంది",+ "followUp.sectionTitle": "ఇంకా సమాధానం లేదు ({count})",+ "followUp.to": "{to} కు",+ "followUp.remindAgain": "మళ్లీ గుర్తు చేయి",+ "followUp.done": "పూర్తయింది","compose.trackOpensOn": "చదివిన రసీదు ఆన్: సందేశం ఎప్పుడు తెరవబడిందో మీరు చూస్తారు","compose.trackOpensOff": "చదివిన రసీదు ఆఫ్","compose.deleteDraft": "డ్రాఫ్ట్ను తొలగించండి",diff --git a/public/locales/th.json b/public/locales/th.jsonindex ee97426..f460ed3 100644--- a/public/locales/th.json+++ b/public/locales/th.json@@ -228,6 +228,22 @@"compose.attachTooltip": "แนบไฟล์ (รวมสูงสุด {max} MB) ไฟล์ที่เกิน 3 MB จะถูกส่งเป็นลิงก์ดาวน์โหลด R2 ที่ใช้ได้ 30 วัน","compose.attachFiles": "แนบไฟล์","compose.trackOpens": "การแจ้งเตือนการอ่าน",+ "followUp.remindMe": "เตือนถ้าไม่มีการตอบกลับ",+ "followUp.remindOn": "เตือนถ้าไม่มีการตอบกลับ: {when}",+ "followUp.in1Day": "ใน 1 วัน",+ "followUp.in3Days": "ใน 3 วัน",+ "followUp.in1Week": "ใน 1 สัปดาห์",+ "followUp.none": "ไม่เตือน",+ "followUp.scheduledFor": "เตือนวันที่ {date} ถ้าไม่มีการตอบกลับ",+ "followUp.noReplyYet": "ยังไม่มีการตอบกลับ การเตือนอยู่ในกล่องจดหมายเข้า",+ "followUp.replied": "ได้รับการตอบกลับแล้ว",+ "followUp.change": "เปลี่ยน",+ "followUp.failed": "ไม่สามารถอัปเดตการเตือนได้",+ "followUp.sectionLabel": "รอการตอบกลับ",+ "followUp.sectionTitle": "ยังไม่มีการตอบกลับ ({count})",+ "followUp.to": "ถึง {to}",+ "followUp.remindAgain": "เตือนอีกครั้ง",+ "followUp.done": "เสร็จสิ้น","compose.trackOpensOn": "เปิดการแจ้งเตือนการอ่าน: คุณจะเห็นเมื่อข้อความถูกเปิด","compose.trackOpensOff": "ปิดการแจ้งเตือนการอ่าน","compose.deleteDraft": "ลบแบบร่าง",diff --git a/public/locales/tr.json b/public/locales/tr.jsonindex 107a0b8..3f955c9 100644--- a/public/locales/tr.json+++ b/public/locales/tr.json@@ -226,6 +226,22 @@"compose.attachTooltip": "Dosya ekleyin (toplam {max} MB'a kadar). 3 MB'tan büyük dosyalar 30 gün geçerli R2 indirme bağlantıları olarak gönderilir.","compose.attachFiles": "Dosya ekle","compose.trackOpens": "Okundu bilgisi",+ "followUp.remindMe": "Yanıt gelmezse hatırlat",+ "followUp.remindOn": "Yanıt gelmezse hatırlatma: {when}",+ "followUp.in1Day": "1 gün sonra",+ "followUp.in3Days": "3 gün sonra",+ "followUp.in1Week": "1 hafta sonra",+ "followUp.none": "Hatırlatma yok",+ "followUp.scheduledFor": "Yanıt gelmezse {date} tarihinde hatırlatma",+ "followUp.noReplyYet": "Henüz yanıt yok. Hatırlatma gelen kutusunda.",+ "followUp.replied": "Yanıt alındı",+ "followUp.change": "Değiştir",+ "followUp.failed": "Hatırlatma güncellenemedi.",+ "followUp.sectionLabel": "Yanıt bekleniyor",+ "followUp.sectionTitle": "Henüz yanıt yok ({count})",+ "followUp.to": "Alıcı: {to}",+ "followUp.remindAgain": "Tekrar hatırlat",+ "followUp.done": "Tamam","compose.trackOpensOn": "Okundu bilgisi açık: iletinin ne zaman açıldığını göreceksiniz","compose.trackOpensOff": "Okundu bilgisi kapalı","compose.deleteDraft": "Taslağı sil",diff --git a/public/locales/uk.json b/public/locales/uk.jsonindex aa6d15b..a5a6898 100644--- a/public/locales/uk.json+++ b/public/locales/uk.json@@ -236,6 +236,22 @@"compose.attachTooltip": "Додати файли (загалом до {max} МБ). Файли понад 3 МБ надсилаються як посилання для завантаження з R2, чинні 30 днів.","compose.attachFiles": "Додати файли","compose.trackOpens": "Відстеження прочитання",+ "followUp.remindMe": "Нагадати, якщо немає відповіді",+ "followUp.remindOn": "Нагадування без відповіді: {when}",+ "followUp.in1Day": "Через 1 день",+ "followUp.in3Days": "Через 3 дні",+ "followUp.in1Week": "Через 1 тиждень",+ "followUp.none": "Без нагадування",+ "followUp.scheduledFor": "Нагадування {date}, якщо немає відповіді",+ "followUp.noReplyYet": "Відповіді ще немає. Нагадування у вхідних.",+ "followUp.replied": "Відповідь отримано",+ "followUp.change": "Змінити",+ "followUp.failed": "Не вдалося оновити нагадування.",+ "followUp.sectionLabel": "Очікують відповіді",+ "followUp.sectionTitle": "Ще без відповіді ({count})",+ "followUp.to": "Кому: {to}",+ "followUp.remindAgain": "Нагадати ще раз",+ "followUp.done": "Готово","compose.trackOpensOn": "Відстеження ввімкнено: ви побачите, коли лист відкриють","compose.trackOpensOff": "Відстеження вимкнено","compose.deleteDraft": "Видалити чернетку",diff --git a/public/locales/ur.json b/public/locales/ur.jsonindex 9b47f8d..7085eac 100644--- a/public/locales/ur.json+++ b/public/locales/ur.json@@ -228,6 +228,22 @@"compose.attachTooltip": "فائلیں منسلک کریں (کل {max} MB تک)۔ 3 MB سے بڑی فائلیں 30 دن کی میعاد والے R2 ڈاؤن لوڈ لنکس کے طور پر بھیجی جاتی ہیں۔","compose.attachFiles": "فائلیں منسلک کریں","compose.trackOpens": "پڑھنے کی رسید",+ "followUp.remindMe": "جواب نہ آئے تو یاد دلائیں",+ "followUp.remindOn": "جواب نہ آنے پر یاد دہانی: {when}",+ "followUp.in1Day": "1 دن میں",+ "followUp.in3Days": "3 دن میں",+ "followUp.in1Week": "1 ہفتے میں",+ "followUp.none": "کوئی یاد دہانی نہیں",+ "followUp.scheduledFor": "{date} کو یاد دہانی اگر جواب نہ آئے",+ "followUp.noReplyYet": "ابھی تک جواب نہیں آیا۔ یاد دہانی ان باکس میں ہے۔",+ "followUp.replied": "جواب موصول ہوا",+ "followUp.change": "تبدیل کریں",+ "followUp.failed": "یاد دہانی اپ ڈیٹ نہیں ہو سکی۔",+ "followUp.sectionLabel": "جواب کا انتظار",+ "followUp.sectionTitle": "ابھی تک جواب نہیں ({count})",+ "followUp.to": "بنام {to}",+ "followUp.remindAgain": "دوبارہ یاد دلائیں",+ "followUp.done": "ہو گیا","compose.trackOpensOn": "پڑھنے کی رسید آن: آپ دیکھیں گے کہ پیغام کب کھولا گیا","compose.trackOpensOff": "پڑھنے کی رسید بند","compose.deleteDraft": "مسودہ حذف کریں",diff --git a/public/locales/vi.json b/public/locales/vi.jsonindex 23a6250..46b84c0 100644--- a/public/locales/vi.json+++ b/public/locales/vi.json@@ -224,6 +224,22 @@"compose.attachTooltip": "Đính kèm tệp (tổng tối đa {max} MB). Các tệp trên 3 MB được gửi dưới dạng liên kết tải xuống R2 có hiệu lực 30 ngày.","compose.attachFiles": "Đính kèm tệp","compose.trackOpens": "Xác nhận đã đọc",+ "followUp.remindMe": "Nhắc tôi nếu không có phản hồi",+ "followUp.remindOn": "Nhắc nếu không có phản hồi: {when}",+ "followUp.in1Day": "Sau 1 ngày",+ "followUp.in3Days": "Sau 3 ngày",+ "followUp.in1Week": "Sau 1 tuần",+ "followUp.none": "Không nhắc",+ "followUp.scheduledFor": "Nhắc vào {date} nếu không có phản hồi",+ "followUp.noReplyYet": "Chưa có phản hồi. Lời nhắc nằm trong hộp thư đến.",+ "followUp.replied": "Đã nhận phản hồi",+ "followUp.change": "Thay đổi",+ "followUp.failed": "Không thể cập nhật lời nhắc.",+ "followUp.sectionLabel": "Đang chờ phản hồi",+ "followUp.sectionTitle": "Chưa có phản hồi ({count})",+ "followUp.to": "Tới {to}",+ "followUp.remindAgain": "Nhắc lại",+ "followUp.done": "Xong","compose.trackOpensOn": "Bật xác nhận đã đọc: bạn sẽ thấy khi thư được mở","compose.trackOpensOff": "Tắt xác nhận đã đọc","compose.deleteDraft": "Xóa thư nháp",diff --git a/public/locales/zh-CN.json b/public/locales/zh-CN.jsonindex d784518..ae4e50d 100644--- a/public/locales/zh-CN.json+++ b/public/locales/zh-CN.json@@ -224,6 +224,22 @@"compose.attachTooltip": "添加附件(总计最大 {max} MB)。超过 3 MB 的文件将以 30 天有效的 R2 下载链接发送。","compose.attachFiles": "添加附件","compose.trackOpens": "已读回执",+ "followUp.remindMe": "无人回复时提醒我",+ "followUp.remindOn": "无人回复时提醒:{when}",+ "followUp.in1Day": "1 天后",+ "followUp.in3Days": "3 天后",+ "followUp.in1Week": "1 周后",+ "followUp.none": "不提醒",+ "followUp.scheduledFor": "若无人回复,将于 {date} 提醒",+ "followUp.noReplyYet": "尚未收到回复。提醒已放入收件箱。",+ "followUp.replied": "已收到回复",+ "followUp.change": "更改",+ "followUp.failed": "无法更新提醒。",+ "followUp.sectionLabel": "等待回复",+ "followUp.sectionTitle": "尚未回复({count})",+ "followUp.to": "收件人:{to}",+ "followUp.remindAgain": "再次提醒",+ "followUp.done": "完成","compose.trackOpensOn": "已读回执已开启:你将看到邮件何时被打开","compose.trackOpensOff": "已读回执已关闭","compose.deleteDraft": "删除草稿",diff --git a/server/runtime/scheduler.ts b/server/runtime/scheduler.tsindex d26f412..30d1774 100644--- a/server/runtime/scheduler.ts+++ b/server/runtime/scheduler.ts@@ -4,6 +4,7 @@ import { runTrashRetention } from "@/lib/email/trash-retention";import { runDriveTrashRetention } from "@/lib/drive/retention";import { runAccountRetention } from "@/lib/accounts/deletion";import { runJmapChangeRetention } from "@/lib/jmap/changes";+import { runFollowUpReminders } from "@/lib/follow-ups/service";/** Fire the daily 02:00 UTC backup and the recurring maintenance jobs, matching the cron triggers in wrangler.jsonc. */export function startScheduler(env: CloudflareEnv) {@@ -12,6 +13,7 @@ export function startScheduler(env: CloudflareEnv) {runAgentMaintenance(env).catch((error) => console.error("Agent maintenance failed", error));runTrashRetention(env).catch((error) => console.error("Trash retention failed", error));const now = new Date();+ runFollowUpReminders(env, now).catch((error) => console.error("Follow-up reminders failed", error));const day = now.toISOString().slice(0, 10);if (now.getUTCHours() !== 2 || lastRunDay === day) return;lastRunDay = day;diff --git a/src/app/api/follow-ups/[id]/route.ts b/src/app/api/follow-ups/[id]/route.tsnew file mode 100644index 0000000..6999341--- /dev/null+++ b/src/app/api/follow-ups/[id]/route.ts@@ -0,0 +1,26 @@+import { NextResponse } from "next/server";+import { getCurrentUser } from "@/lib/auth/cookies";+import { getEnv } from "@/lib/cloudflare";+import { parseFollowUpDays } from "@/lib/follow-ups/follow-up-utils";+import { updateFollowUp } from "@/lib/follow-ups/service";++/** `{ action: "dismiss" }` closes a reminder; `{ action: "snooze", days }` brings it back later. */+export async function PATCH(request: Request, { params }: { params: Promise<{ id: string }> }) {+ const { id } = await params;+ const env = getEnv();+ const user = await getCurrentUser(env, request);+ if (!user) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });+ const body = (await request.json().catch(() => null)) as { action?: unknown; days?: unknown } | null;+ let updated: boolean;+ if (body?.action === "dismiss") {+ updated = await updateFollowUp(env, user.id, id, { action: "dismiss" });+ } else if (body?.action === "snooze") {+ const days = parseFollowUpDays(body.days);+ if (!days) return NextResponse.json({ error: "Choose a reminder delay" }, { status: 400 });+ updated = await updateFollowUp(env, user.id, id, { action: "snooze", days });+ } else {+ return NextResponse.json({ error: "Unknown action" }, { status: 400 });+ }+ if (!updated) return NextResponse.json({ error: "Reminder not found" }, { status: 404 });+ return NextResponse.json({ ok: true });+}diff --git a/src/app/api/follow-ups/route.ts b/src/app/api/follow-ups/route.tsnew file mode 100644index 0000000..3968fb3--- /dev/null+++ b/src/app/api/follow-ups/route.ts@@ -0,0 +1,19 @@+import { NextResponse } from "next/server";+import { getDb } from "@/db";+import { getCurrentUser } from "@/lib/auth/cookies";+import { getEnv } from "@/lib/cloudflare";+import { listDueFollowUps } from "@/lib/follow-ups/service";+import { getMailboxAccessLevel } from "@/lib/mailboxes/access";++/** Reminders of the signed-in user that came due without a reply. */+export async function GET(request: Request) {+ const env = getEnv();+ const user = await getCurrentUser(env, request);+ if (!user) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });+ const mailboxId = new URL(request.url).searchParams.get("mailboxId");+ if (mailboxId) {+ const access = await getMailboxAccessLevel(getDb(env), user, mailboxId);+ if (!access?.canRead) return NextResponse.json({ error: "Mailbox not found" }, { status: 404 });+ }+ return NextResponse.json({ followUps: await listDueFollowUps(env, user.id, mailboxId) });+}diff --git a/src/app/api/messages/[messageId]/follow-up/route.ts b/src/app/api/messages/[messageId]/follow-up/route.tsnew file mode 100644index 0000000..f149524--- /dev/null+++ b/src/app/api/messages/[messageId]/follow-up/route.ts@@ -0,0 +1,61 @@+import { eq } from "drizzle-orm";+import { NextResponse } from "next/server";+import { getDb } from "@/db";+import { messages } from "@/db/schema";+import { getCurrentUser } from "@/lib/auth/cookies";+import { getEnv } from "@/lib/cloudflare";+import { parseFollowUpDays } from "@/lib/follow-ups/follow-up-utils";+import { isMissingTableError } from "@/lib/database-errors";+import { getMessageFollowUp, setFollowUp, updateFollowUp } from "@/lib/follow-ups/service";+import { getMailboxAccessLevel } from "@/lib/mailboxes/access";++type RouteContext = { params: Promise<{ messageId: string }> };++/** The signed-in user and the sent message, when they may read it. Reminders are personal to the user. */+async function loadSentMessage(request: Request, context: RouteContext) {+ const { messageId } = await context.params;+ const env = getEnv();+ const user = await getCurrentUser(env, request);+ if (!user) return { error: NextResponse.json({ error: "Unauthorized" }, { status: 401 }) };+ const db = getDb(env);+ const [message] = await db+ .select({ id: messages.id, mailboxId: messages.mailboxId, direction: messages.direction, status: messages.status })+ .from(messages)+ .where(eq(messages.id, messageId))+ .limit(1);+ const access = message?.mailboxId ? await getMailboxAccessLevel(db, user, message.mailboxId) : null;+ if (!message || !access?.canRead) return { error: NextResponse.json({ error: "Message not found" }, { status: 404 }) };+ return { env, user, message };+}++export async function GET(request: Request, context: RouteContext) {+ const loaded = await loadSentMessage(request, context);+ if ("error" in loaded) return loaded.error;+ if (loaded.message.direction !== "outbound") return NextResponse.json({ followUp: null });+ return NextResponse.json({ followUp: await getMessageFollowUp(loaded.env, loaded.user.id, loaded.message.id) });+}++export async function PUT(request: Request, context: RouteContext) {+ const loaded = await loadSentMessage(request, context);+ if ("error" in loaded) return loaded.error;+ if (loaded.message.direction !== "outbound" || loaded.message.status === "draft") {+ return NextResponse.json({ error: "Only sent messages can have a reminder" }, { status: 400 });+ }+ const body = (await request.json().catch(() => null)) as { days?: unknown } | null;+ const days = parseFollowUpDays(body?.days);+ if (!days) return NextResponse.json({ error: "Choose a reminder delay" }, { status: 400 });+ try {+ return NextResponse.json({ followUp: await setFollowUp(loaded.env, { messageId: loaded.message.id, userId: loaded.user.id, days }) });+ } catch (error) {+ if (isMissingTableError(error)) return NextResponse.json({ error: "Apply pending database migrations first", code: "MIGRATION_REQUIRED" }, { status: 409 });+ throw error;+ }+}++export async function DELETE(request: Request, context: RouteContext) {+ const loaded = await loadSentMessage(request, context);+ if ("error" in loaded) return loaded.error;+ const followUp = await getMessageFollowUp(loaded.env, loaded.user.id, loaded.message.id);+ if (followUp) await updateFollowUp(loaded.env, loaded.user.id, followUp.id, { action: "dismiss" });+ return NextResponse.json({ ok: true });+}diff --git a/src/app/api/send/types.d.ts b/src/app/api/send/types.d.tsindex dd63825..b3c10d8 100644--- a/src/app/api/send/types.d.ts+++ b/src/app/api/send/types.d.ts@@ -20,4 +20,6 @@ export interface SendRequestPayload {undoSend?: boolean;/** Add a read-receipt pixel. */trackOpens?: boolean;+ /** Remind the sender after this many days without a reply. */+ followUpDays?: number;}diff --git a/src/app/api/send/utils.ts b/src/app/api/send/utils.tsindex ac419ae..6eebce3 100644--- a/src/app/api/send/utils.ts+++ b/src/app/api/send/utils.ts@@ -1,6 +1,7 @@import type { AttachmentContent } from "@/lib/email/attachment-types";import { readFormDataBody, readJsonBody } from "@/lib/http/request";import type { SendRequestPayload } from "./types";+import { parseFollowUpDays } from "@/lib/follow-ups/follow-up-utils";const MAX_SEND_REQUEST_SIZE = 30 * 1024 * 1024;@@ -44,6 +45,7 @@ export async function parseSendRequest(request: Request): Promise<SendRequestPayscheduledAt: getOptionalFormValue(form, "scheduledAt"),undoSend: form.get("undoSend") === "true",trackOpens: form.get("trackOpens") === "true",+ followUpDays: parseFollowUpDays(form.get("followUpDays")) ?? undefined,subject: String(form.get("subject") ?? ""),text: getOptionalFormValue(form, "text"),html: getOptionalFormValue(form, "html"),diff --git a/src/components/compose/compose-form.tsx b/src/components/compose/compose-form.tsxindex 75724b9..9cdc0d9 100644--- a/src/components/compose/compose-form.tsx+++ b/src/components/compose/compose-form.tsx@@ -2,7 +2,7 @@import { useEffect, useMemo, useRef, useState } from "react";import type { DragEvent } from "react";-import { ChevronUp, Eye, EyeOff, FileText, Forward, Maximize2, Minimize2, Minus, Paperclip, Reply, Trash2, X } from "lucide-react";+import { BellRing, ChevronUp, Eye, EyeOff, FileText, Forward, Maximize2, Minimize2, Minus, Paperclip, Reply, Trash2, X } from "lucide-react";import { useRouter } from "next/navigation";import { useLanguage } from "@/components/language-provider";import { Button } from "@/components/ui/button";@@ -20,6 +20,8 @@ import type { ReviewSnapshot } from "@/components/agent/send-review-types";import { useIsMobile } from "@/components/sidebar-mobile-utils";import { useSheetViewport } from "./use-sheet-viewport";import { useTrackOpens } from "./use-track-opens";+import { FollowUpMenu } from "@/components/follow-ups/follow-up-menu";+import { followUpOptionKey } from "@/components/follow-ups/follow-up-client-utils";import { buildSendFormData, fetchDraft, formatAttachmentSize } from "./utils";import { RecipientInput } from "./recipient-input";import { RichTextEditor } from "./rich-text-editor";@@ -78,6 +80,7 @@ export function ComposeForm({const [deletingDraft, setDeletingDraft] = useState(false);const [scheduledAt, setScheduledAt] = useState<Date | null>(null);const [trackOpens, setTrackOpens] = useTrackOpens();+ const [followUpDays, setFollowUpDays] = useState<number | null>(null);const [loadedDraftMailboxId, setLoadedDraftMailboxId] = useState<string | null>(null);const [loadedDraftFrom, setLoadedDraftFrom] = useState<string | null>(null);const [selectedFrom, setSelectedFrom] = useState("");@@ -384,6 +387,7 @@ export function ComposeForm({scheduledAt,undoSend: true,trackOpens,+ followUpDays,}),});data = (await res.json()) as { messageId?: string; scheduled?: boolean; undoSeconds?: number; error?: string };@@ -837,6 +841,25 @@ export function ComposeForm({{trackOpens ? <Eye className="h-4 w-4" /> : <EyeOff className="h-4 w-4" />}</button></Tooltip>+ <Tooltip label={followUpDays ? t("followUp.remindOn", { when: t(followUpOptionKey(followUpDays)) }) : t("followUp.remindMe")}>+ <FollowUpMenu+ disabled={loading || loadingDraft}+ onPick={setFollowUpDays}+ onClear={followUpDays ? () => setFollowUpDays(null) : undefined}+ trigger={+ <button+ type="button"+ aria-label={t("followUp.remindMe")}+ className={cn(+ "rounded-md p-1.5 hover:bg-neutral-100 disabled:pointer-events-none disabled:opacity-50 max-md:px-2",+ followUpDays ? "text-amber-600 hover:text-amber-700" : "text-neutral-500 hover:text-neutral-900",+ )}+ >+ <BellRing className="h-4 w-4" />+ </button>+ }+ />+ </Tooltip><span className="flex-1 max-md:hidden" /><Tooltip label={t("compose.deleteDraft")}><buttondiff --git a/src/components/compose/utils.ts b/src/components/compose/utils.tsindex 8c4f758..9c9cf80 100644--- a/src/components/compose/utils.ts+++ b/src/components/compose/utils.ts@@ -30,6 +30,8 @@ export function buildSendFormData(input: {undoSend?: boolean;/** Add a read-receipt pixel to the sent message. */trackOpens?: boolean;+ /** Remind the sender after this many days without a reply. */+ followUpDays?: number | null;}): FormData {const form = new FormData();form.set("from", input.from);@@ -47,6 +49,7 @@ export function buildSendFormData(input: {if (input.scheduledAt) form.set("scheduledAt", input.scheduledAt.toISOString());else if (input.undoSend) form.set("undoSend", "true");if (input.trackOpens) form.set("trackOpens", "true");+ if (input.followUpDays) form.set("followUpDays", String(input.followUpDays));for (const attachment of input.attachments) {form.append("attachments", attachment.file);}diff --git a/src/components/follow-ups/due-follow-ups.tsx b/src/components/follow-ups/due-follow-ups.tsxnew file mode 100644index 0000000..c853e19--- /dev/null+++ b/src/components/follow-ups/due-follow-ups.tsx@@ -0,0 +1,80 @@+"use client";++import Link from "next/link";+import { useCallback, useEffect, useState } from "react";+import { BellRing, Check } from "lucide-react";+import { useLanguage } from "@/components/language-provider";+import { Tooltip } from "@/components/ui/tooltip";+import type { DueFollowUp } from "@/lib/follow-ups/types";+import { formatUserDate } from "@/lib/time/utils";+import { FollowUpMenu } from "./follow-up-menu";+import { fetchDueFollowUps, FOLLOW_UPS_CHANGED_EVENT, updateDueFollowUp } from "./follow-up-client-utils";++const DATE_FORMAT: Intl.DateTimeFormatOptions = { month: "short", day: "2-digit" };+const ACTION_CLASS = "rounded-md p-1.5 text-neutral-500 hover:bg-neutral-100 hover:text-neutral-900";++/** Sent messages still waiting for a reply after their reminder came due, pinned above the inbox. */+export function DueFollowUps({ mailboxId }: { mailboxId?: string | null }) {+ const { t } = useLanguage();+ const [items, setItems] = useState<DueFollowUp[]>([]);+ const [failed, setFailed] = useState(false);++ const load = useCallback(() => {+ void fetchDueFollowUps(mailboxId).then(setItems).catch(() => undefined);+ }, [mailboxId]);++ useEffect(() => {+ load();+ window.addEventListener(FOLLOW_UPS_CHANGED_EVENT, load);+ window.addEventListener("mailflare:messages-changed", load);+ return () => {+ window.removeEventListener(FOLLOW_UPS_CHANGED_EVENT, load);+ window.removeEventListener("mailflare:messages-changed", load);+ };+ }, [load]);++ function update(id: string, change: Parameters<typeof updateDueFollowUp>[1]) {+ setFailed(false);+ setItems((current) => current.filter((item) => item.id !== id));+ void updateDueFollowUp(id, change).catch(() => {+ setFailed(true);+ load();+ });+ }++ if (items.length === 0) return null;++ return (+ <section aria-label={t("followUp.sectionLabel")} className="border-b border-amber-100 bg-amber-50/60">+ <h2 className="flex items-center gap-1.5 px-6 pb-1 pt-2.5 text-xs font-medium text-amber-800">+ <BellRing className="h-3.5 w-3.5" aria-hidden />+ {t("followUp.sectionTitle", { count: items.length })}+ </h2>+ <ul>+ {items.map((item) => (+ <li key={item.id} className="flex items-center gap-2 px-6 py-1.5 text-sm">+ <Link href={`/sent/${item.messageId}`} className="flex min-w-0 flex-1 items-baseline gap-3 hover:underline">+ <span className="w-40 shrink-0 truncate text-neutral-700 max-md:w-28">{t("followUp.to", { to: item.toAddr })}</span>+ <span className="min-w-0 flex-1 truncate font-medium text-neutral-900">{item.subject || t("list.noSubject")}</span>+ <time dateTime={item.sentAt} className="shrink-0 text-xs text-neutral-500">{formatUserDate(item.sentAt, DATE_FORMAT)}</time>+ </Link>+ <FollowUpMenu+ trigger={+ <button type="button" aria-label={t("followUp.remindAgain")} className={ACTION_CLASS}>+ <BellRing className="h-4 w-4" />+ </button>+ }+ onPick={(days) => update(item.id, { action: "snooze", days })}+ />+ <Tooltip label={t("followUp.done")}>+ <button type="button" aria-label={t("followUp.done")} onClick={() => update(item.id, { action: "dismiss" })} className={ACTION_CLASS}>+ <Check className="h-4 w-4" />+ </button>+ </Tooltip>+ </li>+ ))}+ </ul>+ {failed && <p role="alert" className="px-6 pb-2 text-xs text-red-600">{t("followUp.failed")}</p>}+ </section>+ );+}diff --git a/src/components/follow-ups/follow-up-client-utils.ts b/src/components/follow-ups/follow-up-client-utils.tsnew file mode 100644index 0000000..68fadc9--- /dev/null+++ b/src/components/follow-ups/follow-up-client-utils.ts@@ -0,0 +1,50 @@+import { authFetch } from "@/lib/auth/client";+import type { DueFollowUp, MessageFollowUp } from "@/lib/follow-ups/types";+import type { TranslationKey } from "@/lib/i18n/types";++/** Fired after a reminder changes so the inbox block and thread view reload. */+export const FOLLOW_UPS_CHANGED_EVENT = "mailflare:follow-ups-changed";++export function followUpOptionKey(days: number): TranslationKey {+ if (days === 1) return "followUp.in1Day";+ if (days === 7) return "followUp.in1Week";+ return "followUp.in3Days";+}++export async function fetchDueFollowUps(mailboxId?: string | null): Promise<DueFollowUp[]> {+ const query = mailboxId ? `?mailboxId=${encodeURIComponent(mailboxId)}` : "";+ const response = await authFetch(`/api/follow-ups${query}`);+ if (!response.ok) return [];+ return ((await response.json()) as { followUps: DueFollowUp[] }).followUps;+}++export async function fetchMessageFollowUp(messageId: string): Promise<MessageFollowUp | null> {+ const response = await authFetch(`/api/messages/${messageId}/follow-up`);+ if (!response.ok) return null;+ return ((await response.json()) as { followUp: MessageFollowUp | null }).followUp;+}++async function expectOk(response: Response): Promise<void> {+ if (!response.ok) throw new Error(`Follow-up request failed (${response.status})`);+ window.dispatchEvent(new Event(FOLLOW_UPS_CHANGED_EVENT));+}++export async function setMessageFollowUp(messageId: string, days: number): Promise<void> {+ await expectOk(await authFetch(`/api/messages/${messageId}/follow-up`, {+ method: "PUT",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ days }),+ }));+}++export async function clearMessageFollowUp(messageId: string): Promise<void> {+ await expectOk(await authFetch(`/api/messages/${messageId}/follow-up`, { method: "DELETE" }));+}++export async function updateDueFollowUp(id: string, change: { action: "dismiss" } | { action: "snooze"; days: number }): Promise<void> {+ await expectOk(await authFetch(`/api/follow-ups/${id}`, {+ method: "PATCH",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify(change),+ }));+}diff --git a/src/components/follow-ups/follow-up-menu.tsx b/src/components/follow-ups/follow-up-menu.tsxnew file mode 100644index 0000000..772e197--- /dev/null+++ b/src/components/follow-ups/follow-up-menu.tsx@@ -0,0 +1,47 @@+"use client";++import * as DropdownMenu from "@radix-ui/react-dropdown-menu";+import type { ReactNode } from "react";+import { X } from "lucide-react";+import { useLanguage } from "@/components/language-provider";+import { FOLLOW_UP_DAY_OPTIONS } from "@/lib/follow-ups/follow-up-utils";+import { followUpOptionKey } from "./follow-up-client-utils";++const ITEM_CLASS = "flex cursor-pointer items-center rounded-md px-3 py-2 outline-none hover:bg-neutral-100 focus:bg-neutral-100";++/**+ * Picks how many days without a reply before a reminder. `trigger` must be a+ * single focusable element; `onClear` adds a "no reminder" entry.+ */+export function FollowUpMenu({ trigger, onPick, onClear, disabled }: {+ trigger: ReactNode;+ onPick: (days: number) => void;+ onClear?: () => void;+ disabled?: boolean;+}) {+ const { t } = useLanguage();+ return (+ <DropdownMenu.Root>+ <DropdownMenu.Trigger asChild disabled={disabled}>{trigger}</DropdownMenu.Trigger>+ <DropdownMenu.Portal>+ <DropdownMenu.Content align="start" sideOffset={6} className="z-50 min-w-56 rounded-lg border border-neutral-200 bg-white p-1 text-sm shadow-lg">+ <DropdownMenu.Label className="px-3 pb-1 pt-2 text-xs font-medium text-neutral-500">{t("followUp.remindMe")}</DropdownMenu.Label>+ {FOLLOW_UP_DAY_OPTIONS.map((days) => (+ <DropdownMenu.Item key={days} onSelect={() => onPick(days)} className={ITEM_CLASS}>+ {t(followUpOptionKey(days))}+ </DropdownMenu.Item>+ ))}+ {onClear && (+ <>+ <DropdownMenu.Separator className="my-1 h-px bg-neutral-100" />+ <DropdownMenu.Item onSelect={onClear} className={ITEM_CLASS}>+ <X className="mr-2 h-4 w-4" />+ {t("followUp.none")}+ </DropdownMenu.Item>+ </>+ )}+ </DropdownMenu.Content>+ </DropdownMenu.Portal>+ </DropdownMenu.Root>+ );+}diff --git a/src/components/follow-ups/message-follow-up-status.tsx b/src/components/follow-ups/message-follow-up-status.tsxnew file mode 100644index 0000000..ad165f7--- /dev/null+++ b/src/components/follow-ups/message-follow-up-status.tsx@@ -0,0 +1,71 @@+"use client";++import { useCallback, useEffect, useState } from "react";+import { BellRing, Check } from "lucide-react";+import { useLanguage } from "@/components/language-provider";+import type { MessageFollowUp } from "@/lib/follow-ups/types";+import { formatUserDate } from "@/lib/time/utils";+import { FollowUpMenu } from "./follow-up-menu";+import { clearMessageFollowUp, fetchMessageFollowUp, FOLLOW_UPS_CHANGED_EVENT, setMessageFollowUp } from "./follow-up-client-utils";++const DATE_FORMAT: Intl.DateTimeFormatOptions = { weekday: "short", month: "short", day: "2-digit", hour: "2-digit", minute: "2-digit" };+const LINK_CLASS = "font-medium text-blue-600 hover:underline disabled:opacity-50";++/** Reminder state of a sent message, with a way to set, move or remove it. */+export function MessageFollowUpStatus({ messageId }: { messageId: string }) {+ const { t } = useLanguage();+ const [followUp, setFollowUp] = useState<MessageFollowUp | null | undefined>(undefined);+ const [failed, setFailed] = useState(false);++ const load = useCallback(() => {+ void fetchMessageFollowUp(messageId).then(setFollowUp).catch(() => setFollowUp(null));+ }, [messageId]);++ useEffect(() => {+ load();+ window.addEventListener(FOLLOW_UPS_CHANGED_EVENT, load);+ return () => window.removeEventListener(FOLLOW_UPS_CHANGED_EVENT, load);+ }, [load]);++ function run(action: Promise<void>) {+ setFailed(false);+ void action.catch(() => setFailed(true));+ }++ if (followUp === undefined) return null;+ const open = followUp?.status === "pending" || followUp?.status === "due";++ return (+ <p className="mb-3 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-neutral-500">+ {followUp?.status === "replied" ? (+ <>+ <Check className="h-3.5 w-3.5" aria-hidden />+ {t("followUp.replied")}+ </>+ ) : open ? (+ <>+ <BellRing className="h-3.5 w-3.5 text-amber-600" aria-hidden />+ {followUp.status === "due"+ ? t("followUp.noReplyYet")+ : t("followUp.scheduledFor", { date: formatUserDate(followUp.dueAt, DATE_FORMAT) })}+ <FollowUpMenu+ trigger={<button type="button" className={LINK_CLASS}>{t("followUp.change")}</button>}+ onPick={(days) => run(setMessageFollowUp(messageId, days))}+ onClear={() => run(clearMessageFollowUp(messageId))}+ />+ </>+ ) : (+ <FollowUpMenu+ trigger={+ <button type="button" className="inline-flex items-center gap-1.5 hover:text-neutral-900">+ <BellRing className="h-3.5 w-3.5" aria-hidden />+ {t("followUp.remindMe")}+ </button>+ }+ onPick={(days) => run(setMessageFollowUp(messageId, days))}+ />+ )}+ {failed && <span role="alert" className="text-red-600">{t("followUp.failed")}</span>}+ </p>+ );+}diff --git a/src/components/messages/conversation-thread.tsx b/src/components/messages/conversation-thread.tsxindex 24958ce..2017f11 100644--- a/src/components/messages/conversation-thread.tsx+++ b/src/components/messages/conversation-thread.tsx@@ -15,6 +15,7 @@ import { cn } from "@/lib/utils";import type { ConversationMessageCardProps, ConversationThreadProps } from "./conversation-thread-types";import { ThreadMessageActions } from "./thread-message-actions";import { MessageOpenStatus } from "./message-open-status";+import { MessageFollowUpStatus } from "@/components/follow-ups/message-follow-up-status";import {getConversationRecipients,getConversationSender,@@ -217,6 +218,7 @@ export function ConversationMessageCard({{expanded && body && (<div className="pb-4 pt-2 sm:pl-16">{outbound && <MessageOpenStatus messageId={message.id} />}+ {outbound && message.status !== "draft" && <MessageFollowUpStatus messageId={message.id} />}{body.html ? (<EmailHtmlRenderer html={body.html} autoAllowRemote={remote.autoAllow} onAllowRemote={remote.allowSender} />) : (diff --git a/src/components/messages/message-folder-page.tsx b/src/components/messages/message-folder-page.tsxindex 45c2010..c9af021 100644--- a/src/components/messages/message-folder-page.tsx+++ b/src/components/messages/message-folder-page.tsx@@ -49,6 +49,7 @@ import {supportsPermanentDelete,} from "@/lib/messages/permanent-delete-utils";import clsx from "clsx";+import { DueFollowUps } from "@/components/follow-ups/due-follow-ups";const pageSize = 25;@@ -587,6 +588,7 @@ export function MessageFolderPage({)}<div className="min-h-0 flex-1 overflow-y-auto overscroll-contain scrollbar-gutter-stable">+ {config.folder === "inbox" && !config.folderId && offset === 0 && !mailboxesLoading && <DueFollowUps mailboxId={selectedMailbox?.id} />}<div role="list" aria-label={title} className="divide-y divide-neutral-100">{messages.map((message) => (<MessageListRowdiff --git a/src/db/schema/index.ts b/src/db/schema/index.tsindex 836a9d4..d6fb287 100644--- a/src/db/schema/index.ts+++ b/src/db/schema/index.ts@@ -470,6 +470,27 @@ export const messageOpens = sqliteTable((t) => [index("message_opens_token_idx").on(t.token, t.openedAt)],);+/**+ * "Remind me if there is no reply": a sent message whose thread comes back to the+ * inbox at `dueAt` unless an inbound message joined the thread after it.+ */+export const followUps = sqliteTable(+ "follow_ups",+ {+ id: text("id").primaryKey(),+ messageId: text("message_id").notNull().references(() => messages.id, { onDelete: "cascade" }),+ userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),+ dueAt: integer("due_at", { mode: "timestamp" }).notNull(),+ status: text("status", { enum: ["pending", "due", "replied", "dismissed"] }).notNull().default("pending"),+ createdAt: integer("created_at", { mode: "timestamp" }).notNull().$defaultFn(() => new Date()),+ },+ (t) => [+ uniqueIndex("follow_ups_message_idx").on(t.messageId),+ index("follow_ups_status_due_idx").on(t.status, t.dueAt),+ index("follow_ups_user_status_idx").on(t.userId, t.status),+ ],+);+export const emailTemplates = sqliteTable("email_templates",{diff --git a/src/lib/backups/export.ts b/src/lib/backups/export.tsindex 2e6f3c7..bf39575 100644--- a/src/lib/backups/export.ts+++ b/src/lib/backups/export.ts@@ -2,14 +2,14 @@ import type { BackupTableGroupId, DatabaseBackupDocument, DatabaseBackupTable, Dimport { mergeLegacyMessageBodies } from "./utils";import { BACKUP_TABLE_GROUPS, getSelectedBackupTables } from "./table-groups";-export const BACKUP_TABLES: DatabaseBackupTable[] = ["users", "domains", "domain_tracking_hosts", "mailboxes", "mailbox_access", "contacts", "folders", "api_keys", "messages", "message_attachments", "shared_attachment_links", "outbound_jobs", "message_tracking", "message_opens", "routing_rules", "webhooks", "webhook_deliveries", "sessions", "audit_logs", "backup_settings", "backups", "app_settings", "license_settings", "email_templates", "calendar_events", "booking_events", "auto_reply_deliveries", "spam_token_stats", "spam_reputation", "spam_feedback", "mailbox_aliases", "password_reset_tokens", "mfa_recovery_codes", "login_challenges", "mailbox_agent_settings", "agent_conversations", "agent_chat_messages", "agent_jobs", "agent_draft_metadata", "agent_send_approvals", "mcp_key_mailboxes", "ai_usage", "drive_items", "drive_upload_parts", "drive_shares"];+export const BACKUP_TABLES: DatabaseBackupTable[] = ["users", "domains", "domain_tracking_hosts", "mailboxes", "mailbox_access", "contacts", "folders", "api_keys", "messages", "message_attachments", "shared_attachment_links", "outbound_jobs", "message_tracking", "message_opens", "follow_ups", "routing_rules", "webhooks", "webhook_deliveries", "sessions", "audit_logs", "backup_settings", "backups", "app_settings", "license_settings", "email_templates", "calendar_events", "booking_events", "auto_reply_deliveries", "spam_token_stats", "spam_reputation", "spam_feedback", "mailbox_aliases", "password_reset_tokens", "mfa_recovery_codes", "login_challenges", "mailbox_agent_settings", "agent_conversations", "agent_chat_messages", "agent_jobs", "agent_draft_metadata", "agent_send_approvals", "mcp_key_mailboxes", "ai_usage", "drive_items", "drive_upload_parts", "drive_shares"];/*** Tables every backup document must contain. Tables added to BACKUP_TABLES* after the format shipped are absent from older documents, so they stay* optional here and are filled in as empty on restore.*/-/** Added by migrations 0068 and 0069; databases that have not applied them yet back up and restore without them. */-const OPEN_TRACKING_TABLES: DatabaseBackupTable[] = ["domain_tracking_hosts", "message_tracking", "message_opens"];+/** Added by migrations 0068 and later; databases that have not applied them yet back up and restore without them. */+const LATER_MIGRATION_TABLES: DatabaseBackupTable[] = ["domain_tracking_hosts", "message_tracking", "message_opens", "follow_ups"];const REQUIRED_BACKUP_TABLES: DatabaseBackupTable[] = ["users", "domains", "mailboxes", "mailbox_access", "contacts", "folders", "api_keys", "messages", "message_attachments", "outbound_jobs", "routing_rules", "webhooks", "webhook_deliveries", "sessions", "audit_logs", "backup_settings", "backups", "app_settings", "license_settings"];const INSERT_BATCH_SIZE = 50;@@ -82,7 +82,7 @@ export async function exportDatabaseRecords(db: D1Database, excludedGroups: Backif (!includedTables.length) throw new Error("Select at least one backup table group");const tables: DatabaseBackupDocument["tables"] = {};for (const table of includedTables) {- if ((table === "shared_attachment_links" || table === "booking_events" || table.startsWith("drive_") || OPEN_TRACKING_TABLES.includes(table)) && !databaseTables.has(table)) {+ if ((table === "shared_attachment_links" || table === "booking_events" || table.startsWith("drive_") || LATER_MIGRATION_TABLES.includes(table)) && !databaseTables.has(table)) {tables[table] = [];continue;}@@ -110,11 +110,12 @@ export async function restoreDatabaseRecords(db: D1Database, content: ArrayBuffeawait db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('drive_items', 'drive_upload_parts', 'drive_shares')").all<{ name: string }>()).results.map((row) => row.name);if (["drive_items", "drive_upload_parts", "drive_shares"].some((table) => document.tables[table]?.length) && driveTableNames.length !== 3) throw new Error("Apply pending database migrations before restoring the Drive tables.");- const trackingTableNames = (- await db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('domain_tracking_hosts', 'message_tracking', 'message_opens')").all<{ name: string }>()+ const laterTableNames = (+ await db.prepare(`SELECT name FROM sqlite_master WHERE type = 'table' AND name IN (${LATER_MIGRATION_TABLES.map(() => "?").join(", ")})`).bind(...LATER_MIGRATION_TABLES).all<{ name: string }>()).results.map((row) => row.name);- if (OPEN_TRACKING_TABLES.some((table) => document.tables[table]?.length && !trackingTableNames.includes(table))) throw new Error("Apply pending database migrations before restoring read receipts.");- const restoreTables = BACKUP_TABLES.filter((table) => (table !== "shared_attachment_links" || sharedLinksTable) && (table !== "booking_events" || bookingTable) && (!table.startsWith("drive_") || driveTableNames.includes(table)) && (!OPEN_TRACKING_TABLES.includes(table) || trackingTableNames.includes(table)));+ const unmigrated = LATER_MIGRATION_TABLES.filter((table) => document.tables[table]?.length && !laterTableNames.includes(table));+ if (unmigrated.length) throw new Error(`Apply pending database migrations before restoring ${unmigrated.join(", ")}.`);+ const restoreTables = BACKUP_TABLES.filter((table) => (table !== "shared_attachment_links" || sharedLinksTable) && (table !== "booking_events" || bookingTable) && (!table.startsWith("drive_") || driveTableNames.includes(table)) && (!LATER_MIGRATION_TABLES.includes(table) || laterTableNames.includes(table)));const userColumns = new Set((await db.prepare("PRAGMA table_info(users)").all<{ name: string }>()).results.map((column) => column.name));const bookingColumns = bookingTable ? new Set((await db.prepare("PRAGMA table_info(booking_events)").all<{ name: string }>()).results.map((column) => column.name)) : null;for (const table of [...restoreTables].reverse()) await db.prepare(`DELETE FROM ${table}`).run();diff --git a/src/lib/backups/table-groups.ts b/src/lib/backups/table-groups.tsindex c57c46c..4c7f960 100644--- a/src/lib/backups/table-groups.ts+++ b/src/lib/backups/table-groups.ts@@ -2,7 +2,7 @@ import type { BackupTableGroupId, DatabaseBackupTable } from "./types";export const BACKUP_TABLE_GROUPS: { id: BackupTableGroupId; label: string; tables: DatabaseBackupTable[] }[] = [{ id: "accounts", label: "Accounts and mailboxes", tables: ["users", "domains", "domain_tracking_hosts", "mailboxes", "mailbox_access", "mailbox_aliases", "contacts", "api_keys", "mcp_key_mailboxes", "sessions", "password_reset_tokens", "mfa_recovery_codes", "login_challenges"] },- { id: "mail", label: "Mail and related data", tables: ["folders", "messages", "message_attachments", "shared_attachment_links", "outbound_jobs", "message_tracking", "message_opens", "email_templates", "calendar_events", "booking_events", "auto_reply_deliveries", "spam_token_stats", "spam_reputation", "spam_feedback"] },+ { id: "mail", label: "Mail and related data", tables: ["folders", "messages", "message_attachments", "shared_attachment_links", "outbound_jobs", "message_tracking", "message_opens", "follow_ups", "email_templates", "calendar_events", "booking_events", "auto_reply_deliveries", "spam_token_stats", "spam_reputation", "spam_feedback"] },{ id: "automation", label: "Routing and webhooks", tables: ["routing_rules", "webhooks", "webhook_deliveries"] },{ id: "assistant", label: "Assistant and AI usage", tables: ["mailbox_agent_settings", "agent_conversations", "agent_chat_messages", "agent_jobs", "agent_draft_metadata", "agent_send_approvals", "ai_usage"] },{ id: "drive", label: "Drive uploads and shares", tables: ["drive_items", "drive_upload_parts", "drive_shares"] },diff --git a/src/lib/backups/types.d.ts b/src/lib/backups/types.d.tsindex 2c341b3..0b7f436 100644--- a/src/lib/backups/types.d.ts+++ b/src/lib/backups/types.d.ts@@ -1,6 +1,6 @@export type BackupScheduleType = "daily" | "weekly" | "monthly";export type BackupTableGroupId = "accounts" | "mail" | "automation" | "assistant" | "drive" | "system";-export type DatabaseBackupTable = "users" | "domains" | "domain_tracking_hosts" | "mailboxes" | "mailbox_access" | "contacts" | "folders" | "api_keys" | "messages" | "message_attachments" | "shared_attachment_links" | "outbound_jobs" | "message_tracking" | "message_opens" | "routing_rules" | "webhooks" | "webhook_deliveries" | "sessions" | "audit_logs" | "backup_settings" | "backups" | "app_settings" | "license_settings" | "email_templates" | "calendar_events" | "booking_events" | "auto_reply_deliveries" | "spam_token_stats" | "spam_reputation" | "spam_feedback" | "mailbox_aliases" | "password_reset_tokens" | "mfa_recovery_codes" | "login_challenges" | "mailbox_agent_settings" | "agent_conversations" | "agent_chat_messages" | "agent_jobs" | "agent_draft_metadata" | "agent_send_approvals" | "mcp_key_mailboxes" | "ai_usage" | "drive_items" | "drive_upload_parts" | "drive_shares";+export type DatabaseBackupTable = "users" | "domains" | "domain_tracking_hosts" | "mailboxes" | "mailbox_access" | "contacts" | "folders" | "api_keys" | "messages" | "message_attachments" | "shared_attachment_links" | "outbound_jobs" | "message_tracking" | "message_opens" | "follow_ups" | "routing_rules" | "webhooks" | "webhook_deliveries" | "sessions" | "audit_logs" | "backup_settings" | "backups" | "app_settings" | "license_settings" | "email_templates" | "calendar_events" | "booking_events" | "auto_reply_deliveries" | "spam_token_stats" | "spam_reputation" | "spam_feedback" | "mailbox_aliases" | "password_reset_tokens" | "mfa_recovery_codes" | "login_challenges" | "mailbox_agent_settings" | "agent_conversations" | "agent_chat_messages" | "agent_jobs" | "agent_draft_metadata" | "agent_send_approvals" | "mcp_key_mailboxes" | "ai_usage" | "drive_items" | "drive_upload_parts" | "drive_shares";export type DatabaseRecord = Record<string, string | number | null>;export type DatabaseBackupDocument = { format: "mailflare-database-backup"; version: 1 | 2; createdAt: string; includedTables?: DatabaseBackupTable[]; tables: Partial<Record<DatabaseBackupTable, DatabaseRecord[]>>; };diff --git a/src/lib/email/send.ts b/src/lib/email/send.tsindex 20f43b4..90e52c7 100644--- a/src/lib/email/send.ts+++ b/src/lib/email/send.ts@@ -15,6 +15,7 @@ import { getOutboundAttachmentMaxMb } from "@/lib/email/attachment-policy";import { getOutboundProviderConfig, sendThroughProvider } from "@/lib/email/outbound-provider";import { prepareCloudflareAttachments } from "@/lib/email/cloud-attachment-utils";import { ensureTrackingToken, getTrackingHostForSender } from "@/lib/tracking/open-tracking";+import { setFollowUp } from "@/lib/follow-ups/service";import { buildTrackingPixelUrl, injectTrackingPixel, resolveTrackingOrigin } from "@/lib/tracking/open-tracking-utils";export type SendEmailInput = {@@ -42,6 +43,8 @@ export type SendEmailInput = {undoSend?: boolean;/** Add a read-receipt pixel to the HTML part (the stored Sent copy stays without it). */trackOpens?: boolean;+ /** Bring the thread back to the inbox after this many days unless a reply arrives. */+ followUpDays?: number;publicOrigin?: string;};@@ -245,6 +248,10 @@ async function deliverEmail(env: CloudflareEnv, delivery: PreparedDelivery): Pro}).where(eq(messages.id, messageId));await db.update(outboundJobs).set({ status: "sent", updatedAt: new Date() }).where(eq(outboundJobs.id, jobId));+ if (input.followUpDays) {+ // The message is already out; a reminder that cannot be stored must not fail the send.+ await setFollowUp(env, { messageId, userId: input.userId, days: input.followUpDays }).catch((error) => console.error("Follow-up reminder skipped", error));+ }await dispatchWebhooks(env, input.userId, "message.outbound", {messageId,diff --git a/src/lib/follow-ups/follow-up-utils.ts b/src/lib/follow-ups/follow-up-utils.tsnew file mode 100644index 0000000..804da66--- /dev/null+++ b/src/lib/follow-ups/follow-up-utils.ts@@ -0,0 +1,31 @@+/** Reminder delays offered by the composer, in days after delivery. */+export const FOLLOW_UP_DAY_OPTIONS = [1, 3, 7] as const;+export const MAX_FOLLOW_UP_DAYS = 30;++const DAY_MS = 24 * 60 * 60 * 1000;++/** Accepts a whole number of days from a form or JSON body; anything else means no reminder. */+export function parseFollowUpDays(value: unknown): number | null {+ const days = typeof value === "string" ? Number(value.trim()) : value;+ if (typeof days !== "number" || !Number.isInteger(days) || days < 1 || days > MAX_FOLLOW_UP_DAYS) return null;+ return days;+}++export function followUpDueAt(from: Date, days: number): Date {+ return new Date(from.getTime() + days * DAY_MS);+}++/**+ * Whether an inbound message answers the sent one: same mailbox and thread,+ * and received after the send. Replies are threaded by In-Reply-To/References,+ * so a reply to any message in the conversation counts.+ */+export function isReplyTo(+ sent: { mailboxId: string | null; threadId: string | null; createdAt: Date },+ candidate: { mailboxId: string | null; threadId: string | null; direction: string; createdAt: Date },+): boolean {+ return candidate.direction === "inbound" &&+ !!sent.threadId && candidate.threadId === sent.threadId &&+ candidate.mailboxId === sent.mailboxId &&+ candidate.createdAt.getTime() > sent.createdAt.getTime();+}diff --git a/src/lib/follow-ups/service.ts b/src/lib/follow-ups/service.tsnew file mode 100644index 0000000..a538440--- /dev/null+++ b/src/lib/follow-ups/service.ts@@ -0,0 +1,129 @@+import { and, desc, eq, inArray, lte, sql } from "drizzle-orm";+import { getDb } from "@/db";+import { followUps, messages } from "@/db/schema";+import { isMissingTableError } from "@/lib/database-errors";+import { newId } from "@/lib/ids";+import { followUpDueAt } from "./follow-up-utils";+import type { DueFollowUp, MessageFollowUp } from "./types";++/** Rows processed per cron run; the next run picks up the rest. */+const REMINDER_BATCH = 200;+const MAX_LISTED = 50;++/** An inbound message joined the sent message's thread after it was sent. Mirrors `isReplyTo`. */+const hasReply = sql<number>`exists (+ select 1 from messages reply+ where reply.thread_id = ${messages.threadId}+ and reply.mailbox_id = ${messages.mailboxId}+ and reply.direction = 'inbound'+ and reply.created_at > ${messages.createdAt}+)`;++async function markReplied(env: CloudflareEnv, ids: string[]): Promise<void> {+ if (ids.length === 0) return;+ await getDb(env).update(followUps).set({ status: "replied" }).where(inArray(followUps.id, ids));+}++/** Arms (or re-arms) the reminder on a sent message. */+export async function setFollowUp(env: CloudflareEnv, input: { messageId: string; userId: string; days: number; from?: Date }): Promise<MessageFollowUp> {+ const dueAt = followUpDueAt(input.from ?? new Date(), input.days);+ const [row] = await getDb(env)+ .insert(followUps)+ .values({ id: newId("fup"), messageId: input.messageId, userId: input.userId, dueAt })+ .onConflictDoUpdate({ target: followUps.messageId, set: { dueAt, status: "pending", userId: input.userId } })+ .returning({ id: followUps.id, status: followUps.status, dueAt: followUps.dueAt });+ return { id: row.id, status: row.status, dueAt: row.dueAt.toISOString() };+}++/** Five-minute cron: due reminders without a reply surface, the rest are closed as replied. */+export async function runFollowUpReminders(env: CloudflareEnv, now: Date): Promise<void> {+ try {+ const db = getDb(env);+ const rows = await db+ .select({ id: followUps.id, replied: hasReply })+ .from(followUps)+ .innerJoin(messages, eq(messages.id, followUps.messageId))+ .where(and(eq(followUps.status, "pending"), lte(followUps.dueAt, now)))+ .limit(REMINDER_BATCH);+ await markReplied(env, rows.filter((row) => row.replied).map((row) => row.id));+ const due = rows.filter((row) => !row.replied).map((row) => row.id);+ if (due.length) await db.update(followUps).set({ status: "due" }).where(inArray(followUps.id, due));+ } catch (error) {+ if (!isMissingTableError(error)) throw error;+ }+}++/** The user's reminders that came due without a reply, newest first. A reply that arrived since closes them. */+export async function listDueFollowUps(env: CloudflareEnv, userId: string, mailboxId?: string | null): Promise<DueFollowUp[]> {+ try {+ const rows = await getDb(env)+ .select({+ id: followUps.id,+ messageId: followUps.messageId,+ dueAt: followUps.dueAt,+ mailboxId: messages.mailboxId,+ subject: messages.subject,+ toAddr: messages.toAddr,+ sentAt: messages.createdAt,+ replied: hasReply,+ })+ .from(followUps)+ .innerJoin(messages, eq(messages.id, followUps.messageId))+ .where(and(+ eq(followUps.userId, userId),+ eq(followUps.status, "due"),+ ...(mailboxId ? [eq(messages.mailboxId, mailboxId)] : []),+ ))+ .orderBy(desc(followUps.dueAt))+ .limit(MAX_LISTED);+ await markReplied(env, rows.filter((row) => row.replied).map((row) => row.id));+ return rows.filter((row) => !row.replied).map((row) => ({+ id: row.id,+ messageId: row.messageId,+ mailboxId: row.mailboxId,+ subject: row.subject,+ toAddr: row.toAddr,+ sentAt: row.sentAt.toISOString(),+ dueAt: row.dueAt.toISOString(),+ }));+ } catch (error) {+ if (isMissingTableError(error)) return [];+ throw error;+ }+}++export async function getMessageFollowUp(env: CloudflareEnv, userId: string, messageId: string): Promise<MessageFollowUp | null> {+ try {+ const [row] = await getDb(env)+ .select({ id: followUps.id, status: followUps.status, dueAt: followUps.dueAt, replied: hasReply })+ .from(followUps)+ .innerJoin(messages, eq(messages.id, followUps.messageId))+ .where(and(eq(followUps.messageId, messageId), eq(followUps.userId, userId)))+ .limit(1);+ if (!row) return null;+ const open = row.status === "pending" || row.status === "due";+ if (open && row.replied) await markReplied(env, [row.id]);+ return { id: row.id, status: open && row.replied ? "replied" : row.status, dueAt: row.dueAt.toISOString() };+ } catch (error) {+ if (isMissingTableError(error)) return null;+ throw error;+ }+}++/** Dismisses the user's reminder, or pushes it back by `snoozeDays`. Returns false when it is not theirs. */+export async function updateFollowUp(+ env: CloudflareEnv,+ userId: string,+ id: string,+ change: { action: "dismiss" } | { action: "snooze"; days: number },+): Promise<boolean> {+ const set = change.action === "dismiss"+ ? { status: "dismissed" as const }+ : { status: "pending" as const, dueAt: followUpDueAt(new Date(), change.days) };+ const updated = await getDb(env)+ .update(followUps)+ .set(set)+ .where(and(eq(followUps.id, id), eq(followUps.userId, userId)))+ .returning({ id: followUps.id });+ return updated.length > 0;+}diff --git a/src/lib/follow-ups/types.d.ts b/src/lib/follow-ups/types.d.tsnew file mode 100644index 0000000..c3e751b--- /dev/null+++ b/src/lib/follow-ups/types.d.ts@@ -0,0 +1,19 @@+export type FollowUpStatus = "pending" | "due" | "replied" | "dismissed";++/** A reminder that has come due without a reply, as listed at the top of the inbox. */+export type DueFollowUp = {+ id: string;+ messageId: string;+ mailboxId: string | null;+ subject: string | null;+ toAddr: string;+ sentAt: string;+ dueAt: string;+};++/** The reminder on one sent message, for its reading view. */+export type MessageFollowUp = {+ id: string;+ status: FollowUpStatus;+ dueAt: string;+};diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.jsonindex 6ae2610..0451d4d 100644--- a/src/lib/i18n/en.json+++ b/src/lib/i18n/en.json@@ -228,6 +228,22 @@"compose.attachTooltip": "Attach files (up to {max} MB total). Files over 3 MB are sent as 30-day download links.","compose.attachFiles": "Attach files","compose.trackOpens": "Read receipt",+ "followUp.remindMe": "Remind me if no reply",+ "followUp.remindOn": "Reminder if no reply: {when}",+ "followUp.in1Day": "In 1 day",+ "followUp.in3Days": "In 3 days",+ "followUp.in1Week": "In 1 week",+ "followUp.none": "No reminder",+ "followUp.scheduledFor": "Reminder on {date} if no reply",+ "followUp.noReplyYet": "No reply yet. The reminder is in your inbox.",+ "followUp.replied": "Reply received",+ "followUp.change": "Change",+ "followUp.failed": "The reminder could not be updated.",+ "followUp.sectionLabel": "Waiting for a reply",+ "followUp.sectionTitle": "No reply yet ({count})",+ "followUp.to": "To {to}",+ "followUp.remindAgain": "Remind me again",+ "followUp.done": "Done","compose.trackOpensOn": "Read receipt on: you'll see when the message is opened","compose.trackOpensOff": "Read receipt off","compose.deleteDraft": "Delete draft",diff --git a/src/lib/validators.ts b/src/lib/validators.tsindex 7313b3d..3a6717c 100644--- a/src/lib/validators.ts+++ b/src/lib/validators.ts@@ -1,6 +1,7 @@import { z } from "zod";import { getEmailAddress, splitEmailAddressList } from "@/lib/email/address";import { DEFAULT_FOLDER_COLOR, FOLDER_COLOR_VALUES } from "@/lib/folders/colors";+import { MAX_FOLLOW_UP_DAYS } from "@/lib/follow-ups/follow-up-utils";/*** Recipients arrive either as one comma-separated header string (the composer)@@ -32,6 +33,7 @@ export const sendEmailSchema = z.object({scheduledAt: z.string().datetime().optional(),undoSend: z.boolean().optional(),trackOpens: z.boolean().optional(),+ followUpDays: z.number().int().min(1).max(MAX_FOLLOW_UP_DAYS).optional(),attachments: z.array(z.object({diff --git a/tests/follow-ups.test.mjs b/tests/follow-ups.test.mjsnew file mode 100644index 0000000..16a12ab--- /dev/null+++ b/tests/follow-ups.test.mjs@@ -0,0 +1,130 @@+import assert from "node:assert/strict";+import { mkdtempSync, rmSync } from "node:fs";+import { dirname, join } from "node:path";+import test, { after } from "node:test";+import { fileURLToPath, pathToFileURL } from "node:url";+import { build } from "esbuild";++const root = join(dirname(fileURLToPath(import.meta.url)), "..");+const outDir = mkdtempSync(join(root, "tests", ".tmp-follow-ups-"));+after(() => rmSync(outDir, { recursive: true, force: true }));++await build({+ entryPoints: {+ utils: join(root, "src/lib/follow-ups/follow-up-utils.ts"),+ service: join(root, "src/lib/follow-ups/service.ts"),+ database: join(root, "server/runtime/sqlite-database.ts"),+ migrate: join(root, "server/runtime/migrate.ts"),+ },+ outdir: outDir,+ outExtension: { ".js": ".mjs" },+ bundle: true,+ platform: "node",+ format: "esm",+ target: "node22",+ tsconfig: join(root, "tsconfig.json"),+ external: ["better-sqlite3", "drizzle-orm", "drizzle-orm/*"],+ logLevel: "silent",+});++const load = (name) => import(pathToFileURL(join(outDir, `${name}.mjs`)).href);+const utils = await load("utils");+const service = await load("service");+const { SqliteDatabase } = await load("database");+const { applyMigrations } = await load("migrate");++const DAY = 24 * 60 * 60 * 1000;+const seconds = (date) => Math.floor(date.getTime() / 1000);++async function createFixture(t) {+ const database = new SqliteDatabase(join(outDir, `${crypto.randomUUID()}.sqlite`));+ t.after(() => database.db.close());+ await applyMigrations(database, join(root, "drizzle/migrations"));+ const now = seconds(new Date());+ database.db.prepare("INSERT INTO users (id, email, name, password_hash, created_at) VALUES ('u1', '[email protected]', 'Kevin', 'x', ?)").run(now);+ database.db.prepare("INSERT INTO domains (id, user_id, hostname, zone_id, created_at) VALUES ('d1', 'u1', 'example.com', 'zone', ?)").run(now);+ database.db.prepare("INSERT INTO mailboxes (id, user_id, domain_id, local_part, created_at) VALUES ('mb1', 'u1', 'd1', 'kevin', ?)").run(now);+ const addMessage = (id, { direction = "outbound", threadId = "thread-1", mailboxId = "mb1", at = new Date() } = {}) => {+ database.db.prepare(+ "INSERT INTO messages (id, mailbox_id, user_id, direction, from_addr, to_addr, subject, status, thread_id, created_at) VALUES (?, ?, 'u1', ?, '[email protected]', '[email protected]', 'Offer', ?, ?, ?)",+ ).run(id, mailboxId, direction, direction === "outbound" ? "sent" : "received", threadId, seconds(at));+ };+ const status = (messageId) => database.db.prepare("SELECT status FROM follow_ups WHERE message_id = ?").get(messageId)?.status;+ return { env: { DB: database }, addMessage, status };+}++test("parseFollowUpDays accepts whole days from 1 to 30 only", () => {+ assert.equal(utils.parseFollowUpDays("3"), 3);+ assert.equal(utils.parseFollowUpDays(7), 7);+ for (const value of ["0", "31", "1.5", "", "soon", null, undefined, -1]) assert.equal(utils.parseFollowUpDays(value), null, String(value));+});++test("isReplyTo needs an inbound message in the same mailbox and thread, after the send", () => {+ const sent = { mailboxId: "mb1", threadId: "t", createdAt: new Date(1000) };+ const reply = { mailboxId: "mb1", threadId: "t", direction: "inbound", createdAt: new Date(2000) };+ assert.equal(utils.isReplyTo(sent, reply), true);+ assert.equal(utils.isReplyTo(sent, { ...reply, direction: "outbound" }), false);+ assert.equal(utils.isReplyTo(sent, { ...reply, threadId: "other" }), false);+ assert.equal(utils.isReplyTo(sent, { ...reply, mailboxId: "mb2" }), false);+ assert.equal(utils.isReplyTo(sent, { ...reply, createdAt: new Date(500) }), false);+ assert.equal(utils.isReplyTo({ ...sent, threadId: null }, { ...reply, threadId: null }), false);+});++test("a due reminder without a reply surfaces in the inbox list", async (t) => {+ const { env, addMessage, status } = await createFixture(t);+ const sentAt = new Date(Date.now() - 4 * DAY);+ addMessage("sent-1", { at: sentAt });+ addMessage("earlier-inbound", { direction: "inbound", at: new Date(sentAt.getTime() - DAY) });+ await service.setFollowUp(env, { messageId: "sent-1", userId: "u1", days: 3, from: sentAt });++ await service.runFollowUpReminders(env, new Date());+ assert.equal(status("sent-1"), "due");+ const due = await service.listDueFollowUps(env, "u1");+ assert.deepEqual(due.map((item) => item.messageId), ["sent-1"]);+ assert.equal(due[0].subject, "Offer");+ assert.deepEqual(await service.listDueFollowUps(env, "u1", "mb-other"), []);+});++test("a reply closes the reminder, both before and after it came due", async (t) => {+ const { env, addMessage, status } = await createFixture(t);+ const sentAt = new Date(Date.now() - 4 * DAY);+ addMessage("answered", { at: sentAt, threadId: "thread-a" });+ addMessage("reply-a", { direction: "inbound", threadId: "thread-a", at: new Date(sentAt.getTime() + DAY) });+ addMessage("late", { at: sentAt, threadId: "thread-b" });+ await service.setFollowUp(env, { messageId: "answered", userId: "u1", days: 3, from: sentAt });+ await service.setFollowUp(env, { messageId: "late", userId: "u1", days: 3, from: sentAt });++ await service.runFollowUpReminders(env, new Date());+ assert.equal(status("answered"), "replied");+ assert.equal(status("late"), "due");++ addMessage("reply-b", { direction: "inbound", threadId: "thread-b" });+ assert.deepEqual(await service.listDueFollowUps(env, "u1"), []);+ assert.equal(status("late"), "replied");+ assert.equal((await service.getMessageFollowUp(env, "u1", "late")).status, "replied");+});++test("reminders that are not yet due stay pending; snooze and dismiss belong to their owner", async (t) => {+ const { env, addMessage, status } = await createFixture(t);+ addMessage("fresh");+ const followUp = await service.setFollowUp(env, { messageId: "fresh", userId: "u1", days: 1 });+ await service.runFollowUpReminders(env, new Date());+ assert.equal(status("fresh"), "pending");++ assert.equal(await service.updateFollowUp(env, "someone-else", followUp.id, { action: "dismiss" }), false);+ assert.equal(await service.updateFollowUp(env, "u1", followUp.id, { action: "dismiss" }), true);+ assert.equal(status("fresh"), "dismissed");+ assert.equal(await service.updateFollowUp(env, "u1", followUp.id, { action: "snooze", days: 3 }), true);+ assert.equal(status("fresh"), "pending");+ const again = await service.getMessageFollowUp(env, "u1", "fresh");+ assert.ok(new Date(again.dueAt).getTime() > Date.now() + 2 * DAY);+});++test("without migration 0071 reminders are absent instead of failing", async (t) => {+ const database = new SqliteDatabase(join(outDir, `${crypto.randomUUID()}.sqlite`));+ t.after(() => database.db.close());+ const env = { DB: database };+ await service.runFollowUpReminders(env, new Date());+ assert.deepEqual(await service.listDueFollowUps(env, "u1"), []);+ assert.equal(await service.getMessageFollowUp(env, "u1", "m1"), null);+});diff --git a/worker.ts b/worker.tsindex e97a05e..1cc596b 100644--- a/worker.ts+++ b/worker.ts@@ -24,6 +24,7 @@ import { runTrashRetention } from "./src/lib/email/trash-retention";import { runDriveTrashRetention } from "./src/lib/drive/retention";import { runAccountRetention } from "./src/lib/accounts/deletion";import { runJmapChangeRetention } from "./src/lib/jmap/changes";+import { runFollowUpReminders } from "./src/lib/follow-ups/service";export { RealtimeHub } from "./src/lib/realtime/hub";export default {@@ -134,6 +135,7 @@ export default {if (controller.cron === "0 2 * * *") ctx.waitUntil(runScheduledDatabaseBackup(env, new Date(controller.scheduledTime)));ctx.waitUntil(runAgentMaintenance(env));ctx.waitUntil(runTrashRetention(env, new Date(controller.scheduledTime)));+ ctx.waitUntil(runFollowUpReminders(env, new Date(controller.scheduledTime)));if (controller.cron === "0 2 * * *") ctx.waitUntil(runAccountRetention(env, new Date(controller.scheduledTime)));// Drive trash is emptied once a day, with the 02:00 UTC cron; the 5-minute cron is for queue-like upkeep.if (controller.cron === "0 2 * * *") ctx.waitUntil(runDriveTrashRetention(env, new Date(controller.scheduledTime)));