move testing to just alerts

This commit is contained in:
Your Name 2024-01-10 14:35:09 -05:00
parent 7214e0a73f
commit b79e38a5f9
2 changed files with 5 additions and 4 deletions

View File

@ -9,7 +9,7 @@ import (
"time" "time"
) )
// //
func SendRegistrationEmail(recipient, username, password string) bool { func SendRegistrationEmail(recipient, username, password string) bool {
data := struct { data := struct {
SiteName string SiteName string
@ -158,6 +158,9 @@ func SendMail(addr, from, subject, body string, to string) error {
// //
func SendAlert(u int64, subject, body string) error { func SendAlert(u int64, subject, body string) error {
if c.Testing {
return nil
}
user, ok := GetById(u) user, ok := GetById(u)
if !ok { if !ok {
return fmt.Errorf("scsusers.SendAlert: User %d not found", u) return fmt.Errorf("scsusers.SendAlert: User %d not found", u)

View File

@ -96,9 +96,7 @@ func Register(username, email, ip string) bool {
log.Printf("scsusers.Register: insert failed: %s\n", err.Error()) log.Printf("scsusers.Register: insert failed: %s\n", err.Error())
return false return false
} }
if c.Testing {
return true
}
if SendRegistrationEmail(email, username, string(pass)) { if SendRegistrationEmail(email, username, string(pass)) {
log.Printf("scsusers.Register: New user registration: %s from %s\n", username, ip) log.Printf("scsusers.Register: New user registration: %s from %s\n", username, ip)
return true return true