fix(PROJ-86): Manticore-Index-Drift (emails_global) + Datumssortierung bei fehlendem Date-Header
emails_global bekam nie Tenant-Mails gespiegelt, Superadmin-Suche sah nur
~30% aller Mails. Zusätzlich sanken Mails ohne gültigen Date-Header
(date_ts=0) beim datumssortierten Listing ans Ende aller Ergebnisse und
waren dadurch praktisch unauffindbar ("GUI zeigt neue Mails nicht") -
Import/Indexierung liefen technisch korrekt, nur Sortierung/Spiegelung
waren kaputt.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UPFC6Jk2ke1Pq9XcuVGP1R
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
7727ad5cdf
commit
26c0e04c75
@@ -5,6 +5,18 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// EffectiveDate returns headerDate for sorting/filtering unless it is the
|
||||
// zero value (missing or unparseable Date: header — common in spam), in
|
||||
// which case fallback (typically received_at) is used instead. Without this,
|
||||
// mails with a bad Date header get date_ts=0 and sink to the bottom of every
|
||||
// date-sorted search result, effectively hiding them from the mail list.
|
||||
func EffectiveDate(headerDate, fallback time.Time) time.Time {
|
||||
if headerDate.IsZero() {
|
||||
return fallback
|
||||
}
|
||||
return headerDate
|
||||
}
|
||||
|
||||
// MailDocument is the indexed representation of a stored email.
|
||||
type MailDocument struct {
|
||||
ID string
|
||||
|
||||
Reference in New Issue
Block a user