From 66dc3a171e917e888d5eac46ccb034c3d6609def Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Wed, 20 May 2026 23:53:52 +0000 Subject: [PATCH] Create communication creation events for non-compliance reports --- platform/publicreport.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/publicreport.go b/platform/publicreport.go index 640b8ea9..8803b29d 100644 --- a/platform/publicreport.go +++ b/platform/publicreport.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "math/big" + "strconv" "strings" "time" @@ -433,6 +434,7 @@ func publicReportCreate(ctx context.Context, setter_report modelpublicreport.Rep // Only create communication entries for compliance when they're submitted report_type := setter_report.ReportType + var comm_id int if report_type != modelpublicreport.Reporttype_Compliance { comm := model.Communication{ Created: time.Now(), @@ -450,6 +452,7 @@ func publicReportCreate(ctx context.Context, setter_report modelpublicreport.Rep return result, fmt.Errorf("insert communication: %w", err) } log.Debug().Int32("id", comm.ID).Msg("inserted new communication") + comm_id = int(comm.ID) } if err := txn.Commit(ctx); err != nil { @@ -461,6 +464,13 @@ func publicReportCreate(ctx context.Context, setter_report modelpublicreport.Rep organization_id, result.PublicID, ) + if report_type != modelpublicreport.Reporttype_Compliance && comm_id != 0 { + event.Created( + event.TypeCommunication, + organization_id, + strconv.Itoa(comm_id), + ) + } return result, nil } func publicReportUpdateAddressID(ctx context.Context, txn db.Tx, report *modelpublicreport.Report, address types.Address) error {