From 6bbf9e4cfd34583223fbaccd294ca6fb8da7e50e Mon Sep 17 00:00:00 2001 From: chahinebrini Date: Sat, 16 May 2026 05:26:52 +0200 Subject: [PATCH] =?UTF-8?q?fix(native/mail):=20k=C3=BCrzlich-blockiert=20u?= =?UTF-8?q?ses=20createdAt,=20not=20the=20original=20receive=20date?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User saw entries like "vor 61d · Outlook" under the "Kürzlich blockiert · In den letzten 24h" header. createdAt (when the daemon wrote the mail_blocked row) is always inside the 24h retention window because deleteOldMailBlocked sweeps everything older than that on every fetch — but the row preserves the original receivedAt header from the email, which for old Casino mails the daemon only just got around to scanning can be weeks or months ago. Switched the time-label in MailActivityLog to format createdAt instead. The MailBlockedItem type now carries createdAt explicitly (the backend has been returning it all along, the FE type just hadn't acknowledged it). receivedAt stays in the shape for any future "received vs blocked" comparison view but isn't used in the recent- activity list anymore. --- apps/rebreak-native/components/mail/MailActivityLog.tsx | 6 +++++- apps/rebreak-native/hooks/useMailResults.ts | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/rebreak-native/components/mail/MailActivityLog.tsx b/apps/rebreak-native/components/mail/MailActivityLog.tsx index 40df865..f8192d6 100644 --- a/apps/rebreak-native/components/mail/MailActivityLog.tsx +++ b/apps/rebreak-native/components/mail/MailActivityLog.tsx @@ -248,7 +248,11 @@ function ActivityItem({ const providerLabel = item.connection?.providerLabel ?? ( item.senderEmail ? domainFromEmail(item.senderEmail) : null ); - const timeLabel = formatDate(item.receivedAt, t); + // createdAt = wann WIR die Mail geblockt haben. receivedAt = wann der + // Sender sie ursprünglich rausgeschickt hat — bei alten Casino-Mails die + // wir gerade erst gescant haben, ist das oft Wochen/Monate her und + // verwirrt den User in der "Kürzlich blockiert"-Liste. + const timeLabel = formatDate(item.createdAt, t); const subLine = [timeLabel, providerLabel].filter(Boolean).join(' · '); return ( diff --git a/apps/rebreak-native/hooks/useMailResults.ts b/apps/rebreak-native/hooks/useMailResults.ts index c88766a..f9315db 100644 --- a/apps/rebreak-native/hooks/useMailResults.ts +++ b/apps/rebreak-native/hooks/useMailResults.ts @@ -6,7 +6,10 @@ export type MailBlockedItem = { subject: string; senderEmail: string; senderName: string | null; + /** Wann die Mail beim Sender raus / im User-Postfach ankam (kann Wochen zurückliegen). */ receivedAt: string; + /** Wann der Daemon die Mail geblockt hat — das ist die richtige Zeit für "Kürzlich blockiert". */ + createdAt: string; connectionId: string; connection?: { id: string;