Fix references to report organization ID
This commit is contained in:
parent
685b7456b6
commit
5cfd16e6a0
1 changed files with 3 additions and 4 deletions
|
|
@ -44,16 +44,15 @@ func postRegisterNotifications(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
defer txn.Rollback(ctx)
|
||||
location, err := models.PublicreportReports.Query(
|
||||
rep, err := models.PublicreportReports.Query(
|
||||
models.SelectWhere.PublicreportReports.PublicID.EQ(report_id),
|
||||
).One(ctx, db.PGInstance.BobDB)
|
||||
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)
|
||||
return
|
||||
}
|
||||
|
||||
org_id := location.OrganizationID.MustGet()
|
||||
e := report.SaveReporter(ctx, txn, report_id, name, email, phone, has_consent)
|
||||
if e != nil {
|
||||
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)
|
||||
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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue