Chat reports: attach target user ID table

This commit is contained in:
Noah Petherbridge 2023-08-16 17:30:39 -07:00
parent dc5b82b59a
commit 5f5fe37350

View File

@ -104,6 +104,15 @@ func Report() http.HandlerFunc {
currentUser = nil
}
// Look up the AboutUser ID if possible.
targetUser, err := models.FindUser(report.AboutUsername)
if err == nil {
fb.TableName = "users"
fb.TableID = targetUser.ID
} else {
log.Error("BareRTC Chat Feedback: couldn't find user ID for AboutUsername=%s: %s", report.AboutUsername, err)
}
// Save the feedback.
if err := models.CreateFeedback(fb); err != nil {
log.Error("Couldn't save feedback from BareRTC report endpoint: %s", err)