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:
2026-08-27 06:55:24 +00:00
committed by codegirl007
parent 35c8c9f391
commit 418ef93da5
28 changed files with 827 additions and 74 deletions
+18
View File
@@ -42,9 +42,17 @@ func (m *Memory) CreateUser(_ context.Context, u *User) error {
return fmt.Errorf("invalid role")
}
u.Username = NormalizeUsername(u.Username)
u.Email = NormalizeEmail(u.Email)
if _, ok := m.byName[u.Username]; ok {
return ErrDuplicateUsername
}
if u.Email != "" {
for _, existing := range m.users {
if existing.Email == u.Email {
return ErrDuplicateEmail
}
}
}
if u.ID == "" {
u.ID = uuid.NewString()
}
@@ -179,11 +187,21 @@ func (m *Memory) SaveUserProfile(_ context.Context, u *User) error {
if !ok {
return sql.ErrNoRows
}
email := NormalizeEmail(u.Email)
if email != "" {
for id, existing := range m.users {
if id != u.ID && existing.Email == email {
return ErrDuplicateEmail
}
}
}
cur.State = strings.TrimSpace(u.State)
cur.Email = email
if u.AvatarURL != "" {
cur.AvatarURL = u.AvatarURL
}
u.State = cur.State
u.Email = cur.Email
u.AvatarURL = cur.AvatarURL
return nil
}