diff --git a/rmo/notification.go b/rmo/notification.go index 3cb6fdd2..1fbb8239 100644 --- a/rmo/notification.go +++ b/rmo/notification.go @@ -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) }