Notify question authors via Resend when an admin posts the first answer.

Require email at registration (editable on profile), add a Resend mailer with idempotent first-answer sends, and keep answer saves independent of delivery.
This commit is contained in:
2026-08-22 12:39:43 -07:00
parent 35c8c9f391
commit f61b4fc7ab
23 changed files with 589 additions and 71 deletions
+34
View File
@@ -0,0 +1,34 @@
package mail
import (
"context"
"sync"
)
// Recording is a test Notifier that records calls.
type Recording struct {
mu sync.Mutex
Msgs []QuestionAnswered
}
func (r *Recording) NotifyQuestionAnswered(_ context.Context, msg QuestionAnswered) error {
r.mu.Lock()
defer r.mu.Unlock()
r.Msgs = append(r.Msgs, msg)
return nil
}
func (r *Recording) Len() int {
r.mu.Lock()
defer r.mu.Unlock()
return len(r.Msgs)
}
// Snapshot returns a copy of recorded messages.
func (r *Recording) Snapshot() []QuestionAnswered {
r.mu.Lock()
defer r.mu.Unlock()
out := make([]QuestionAnswered, len(r.Msgs))
copy(out, r.Msgs)
return out
}