diff --git a/platform/publicreport.go b/platform/publicreport.go index 8803b29d..0e8e5ad9 100644 --- a/platform/publicreport.go +++ b/platform/publicreport.go @@ -166,6 +166,7 @@ func PublicReportUpdateCompliance(ctx context.Context, public_id string, report_ return fmt.Errorf("find compliance %d: %w", report.ID, err) } // Don't allow modifying of the submission date if it's set + var comm_id int if compliance_updates.Has(tablepublicreport.Compliance.Submitted) { if compliance.Submitted != nil { compliance_updates.Unset(tablepublicreport.Compliance.Submitted) @@ -195,6 +196,7 @@ func PublicReportUpdateCompliance(ctx context.Context, public_id string, report_ return fmt.Errorf("insert communication log entry: %w", err) } log.Debug().Int32("id", comm.ID).Msg("inserted new communication") + comm_id = int(comm.ID) } } @@ -248,6 +250,13 @@ func PublicReportUpdateCompliance(ctx context.Context, public_id string, report_ if err := txn.Commit(ctx); err != nil { return fmt.Errorf("commit: %w", err) } + if comm_id != 0 { + event.Created( + event.TypeCommunication, + report.OrganizationID, + strconv.Itoa(comm_id), + ) + } return nil } func PublicReportReporterUpdated(ctx context.Context, org_id int32, report_id string) {