Fix WhatsApp FetchNew to respect lastSeen map

This commit is contained in:
Johan Jongsma 2026-02-02 22:31:26 +00:00
parent 79cfb0caa6
commit 24761c77f0
1 changed files with 7 additions and 1 deletions

View File

@ -144,9 +144,15 @@ func (w *WhatsAppConnector) FetchNew() ([]UnifiedMessage, error) {
return nil, err
}
w.mu.Lock()
defer w.mu.Unlock()
var result []UnifiedMessage
for _, msg := range messages {
// WhatsApp bridge doesn't track seen status, so return all recent
// Skip if already marked as seen
if w.lastSeen[msg.ID] {
continue
}
// Filter to last 24 hours for "new"
if time.Since(msg.Timestamp) < 24*time.Hour {
result = append(result, w.convertMessage(msg))