From 79e9439858dbb99e230477b2fcddea4e986494fd Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Tue, 24 Jun 2025 17:06:44 +1200 Subject: [PATCH] Fix: Align websocket new message values with global Message Summary (no null values) (#526) --- internal/storage/messages.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/internal/storage/messages.go b/internal/storage/messages.go index 2ead654..f4e206d 100644 --- a/internal/storage/messages.go +++ b/internal/storage/messages.go @@ -168,6 +168,24 @@ func Store(body *[]byte, username *string) (string, error) { return "", err } + // we do not want to to broadcast null values for MetaData else this does not align + // with the message summary documented in the API docs, so we set them to empty slices. + if c.From == nil { + c.From = &mail.Address{} + } + if c.To == nil { + c.To = []*mail.Address{} + } + if c.Cc == nil { + c.Cc = []*mail.Address{} + } + if c.Bcc == nil { + c.Bcc = []*mail.Address{} + } + if c.ReplyTo == nil { + c.ReplyTo = []*mail.Address{} + } + c.Created = created c.ID = id c.MessageID = messageID