diff --git a/internal/beads/beads_channel.go b/internal/beads/beads_channel.go index a7c56175..f9f24560 100644 --- a/internal/beads/beads_channel.go +++ b/internal/beads/beads_channel.go @@ -9,6 +9,7 @@ import ( "os" "strconv" "strings" + "time" ) // ChannelFields holds structured fields for channel beads. @@ -146,6 +147,7 @@ func (b *Beads) CreateChannelBead(name string, subscribers []string, createdBy s Subscribers: subscribers, Status: ChannelStatusActive, CreatedBy: createdBy, + CreatedAt: time.Now().Format(time.RFC3339), } description := FormatChannelDescription(title, fields) diff --git a/internal/beads/beads_group.go b/internal/beads/beads_group.go index 5c2213ff..ed1a80db 100644 --- a/internal/beads/beads_group.go +++ b/internal/beads/beads_group.go @@ -8,6 +8,7 @@ import ( "fmt" "os" "strings" + "time" ) // GroupFields holds structured fields for group beads. @@ -114,6 +115,7 @@ func (b *Beads) CreateGroupBead(name string, members []string, createdBy string) Name: name, Members: members, CreatedBy: createdBy, + CreatedAt: time.Now().Format(time.RFC3339), } description := FormatGroupDescription(title, fields) diff --git a/internal/mail/router.go b/internal/mail/router.go index 28509899..c5d1bedd 100644 --- a/internal/mail/router.go +++ b/internal/mail/router.go @@ -829,6 +829,9 @@ func (r *Router) sendToChannel(msg *Message) error { if fields == nil { return fmt.Errorf("channel not found: %s", channelName) } + if fields.Status == beads.ChannelStatusClosed { + return fmt.Errorf("channel %s is closed", channelName) + } // Build labels for from/thread/reply-to/cc plus channel metadata var labels []string