Tweak email formatting for chat room reports

This commit is contained in:
Noah Petherbridge 2023-08-12 21:47:33 -07:00
parent 8ac63bf800
commit d37ab56f26

View File

@ -67,6 +67,9 @@ func Report() http.HandlerFunc {
// Get the report out.
report := req.Report
if report.Comment == "" {
report.Comment = "(no comment)"
}
log.Debug("Got chat report: %+v", report)
@ -95,8 +98,11 @@ func Report() http.HandlerFunc {
}
// Get the Reply-To user if possible.
if user, err := models.FindUser(report.FromUsername); err == nil {
fb.UserID = user.ID
currentUser, err := models.FindUser(report.FromUsername)
if err == nil {
fb.UserID = currentUser.ID
} else {
currentUser = nil
}
// Save the feedback.
@ -107,15 +113,16 @@ func Report() http.HandlerFunc {
// Email the admins.
if err := mail.Send(mail.Message{
To: config.Current.AdminEmail,
Subject: "Chat Room Report",
Subject: "User Feedback: Chat Room Report",
Template: "email/contact_admin.html",
Data: map[string]interface{}{
"Title": "Chat Room Report",
"Intent": fb.Intent,
"Subject": fb.Subject,
"Message": "Please check on the admin dashboard of nonshy.com",
"BaseURL": config.Current.BaseURL,
"AdminURL": config.Current.BaseURL + "/admin/feedback",
"Title": "Chat Room Report",
"Intent": fb.Intent,
"Subject": fb.Subject,
"Message": fb.Message,
"CurrentUser": currentUser,
"BaseURL": config.Current.BaseURL,
"AdminURL": config.Current.BaseURL + "/admin/feedback",
},
}); err != nil {
log.Error("/v1/barertc/report page: couldn't send email: %s", err)