MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / publishApproved

Method publishApproved

internal/agent/api.go:380–397  ·  view source on GitHub ↗

publishApproved fires email.review_approved via the outbox (PublishBestEffortTx — POST-side-effect: SES has already accepted the approved send) AND the legacy goroutine.

(ctx context.Context, e webhookpub.Event, sentMsg *identity.Message)

Source from the content-addressed store, hash-verified

378// (PublishBestEffortTx — POST-side-effect: SES has already accepted
379// the approved send) AND the legacy goroutine.
380func (a *API) publishApproved(ctx context.Context, e webhookpub.Event, sentMsg *identity.Message) {
381 var outboxWrote bool
382 if a.outbox != nil && sentMsg != nil {
383 e.ID = webhookpub.DeterministicEventID(sentMsg.ID, e.Type)
384 err := a.store.WithTx(ctx, func(tx pgx.Tx) error {
385 outboxWrote = a.outbox.PublishBestEffortTx(ctx, tx, e)
386 return nil
387 })
388 if err != nil {
389 log.Printf("[api] outbox tx for %s err: %v", e.Type, err)
390 outboxWrote = false
391 }
392 }
393 a.emit().OutboxEventsPublished(e.Type)
394 if a.shouldFireLegacy(outboxWrote) {
395 a.publishAsync(e)
396 }
397}
398
399// publishRejected fires email.review_rejected via the outbox (PublishTx —
400// pre-side-effect: rejection is a row update, no SES involvement) AND

Callers 2

ApprovePendingCoreMethod · 0.95

Calls 7

emitMethod · 0.95
shouldFireLegacyMethod · 0.95
publishAsyncMethod · 0.95
DeterministicEventIDFunction · 0.92
WithTxMethod · 0.80
PublishBestEffortTxMethod · 0.65
OutboxEventsPublishedMethod · 0.65

Tested by

no test coverage detected