Fix references to report organization ID

This commit is contained in:
Eli Ribble 2026-03-18 19:00:40 +00:00
parent 685b7456b6
commit 5cfd16e6a0
No known key found for this signature in database

View file

@ -44,16 +44,15 @@ func postRegisterNotifications(w http.ResponseWriter, r *http.Request) {
return return
} }
defer txn.Rollback(ctx) defer txn.Rollback(ctx)
location, err := models.PublicreportReports.Query( rep, err := models.PublicreportReports.Query(
models.SelectWhere.PublicreportReports.PublicID.EQ(report_id), models.SelectWhere.PublicreportReports.PublicID.EQ(report_id),
).One(ctx, db.PGInstance.BobDB) ).One(ctx, db.PGInstance.BobDB)
if err != nil { if err != nil {
log.Error().Err(err).Msg("Failed to get report location") log.Error().Err(err).Msg("Failed to get report")
http.Redirect(w, r, fmt.Sprintf("/error?code=report-location-failed&report=%s", report_id), http.StatusFound) http.Redirect(w, r, fmt.Sprintf("/error?code=report-location-failed&report=%s", report_id), http.StatusFound)
return return
} }
org_id := location.OrganizationID.MustGet()
e := report.SaveReporter(ctx, txn, report_id, name, email, phone, has_consent) e := report.SaveReporter(ctx, txn, report_id, name, email, phone, has_consent)
if e != nil { if e != nil {
log.Error().Err(e).Str("name", name).Msg("Failed to save reporter") log.Error().Err(e).Str("name", name).Msg("Failed to save reporter")
@ -93,7 +92,7 @@ func postRegisterNotifications(w http.ResponseWriter, r *http.Request) {
} }
} }
txn.Commit(ctx) txn.Commit(ctx)
platform.PublicReportReporterUpdated(ctx, org_id, report_id) platform.PublicReportReporterUpdated(ctx, rep.OrganizationID, report_id)
http.Redirect(w, r, fmt.Sprintf("/register-notifications-complete?report=%s", report_id), http.StatusFound) http.Redirect(w, r, fmt.Sprintf("/register-notifications-complete?report=%s", report_id), http.StatusFound)
} }