Add polished answer notifications (#1)
Sends a branded Resend email when a question receives its first answer, records accepted and failed sends, and adds collapsed answer editing with cancel behavior. Co-authored-by: codegirl-007 <s.raide@gmail.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user