This commit is contained in:
2026-08-16 09:02:39 +08:00
parent c554152f4f
commit f7f6db8695
105 changed files with 2535 additions and 948 deletions
+11 -3
View File
@@ -32,9 +32,17 @@ func (uc *EmailUsecase) Alert(ctx context.Context, subject, body string) error {
if !uc.repo.Enabled() {
return nil
}
recipients := uc.repo.DefaultRecipients()
if len(recipients) == 0 {
return nil
// ErrorToEmail splits the configured comma-separated recipient
// string, while its explicit test endpoint deliberately sends the whole
// value as one recipient. Keep those two contracts separate.
configured := uc.repo.DefaultRecipients()
recipients := make([]string, 0, len(configured))
for _, value := range configured {
parts := strings.Split(value, ",")
if len(parts) > 1 && parts[len(parts)-1] == "" {
parts = parts[:len(parts)-1]
}
recipients = append(recipients, parts...)
}
return uc.repo.Send(ctx, recipients, subject, body)
}