Skip to content

Conversation

@jcscottiii
Copy link
Collaborator

This commit enhances the email delivery job by including the associated job triggers.

Previously, the EmailDeliveryJob struct did not contain trigger information, which limited the ability to customize email content based on why a notification was sent.

This change introduces a Triggers []JobTrigger field to lib/workertypes/EmailDeliveryJob and lib/event/emailjob/v1/EmailJobEvent. Helper functions are added to lib/event/emailjob/v1/types.go for converting between internal workertypes.JobTrigger and emailjob/v1.JobTrigger types.

Additionally, the SummaryHighlight struct in lib/workertypes/types.go now includes a MatchesTrigger method, encapsulating the logic for checking if a highlight satisfies a given trigger. This method is then utilized in workers/push_delivery/pkg/dispatcher/dispatcher.go within the matchesTrigger function, centralizing the trigger matching logic.

The EmailWorkerSubscriberAdapter in lib/gcppubsub/gcppubsubadapters/email_worker.go and PushDeliveryPublisher in lib/gcppubsub/gcppubsubadapters/push_delivery.go are updated to correctly pass and receive these triggers. Corresponding tests have also been updated to reflect these changes.

This refactoring allows the email worker to eventually render more dynamic and personalized email content based on the specific triggers that caused the notification.

This commit enhances the email delivery job by including the associated job triggers.

Previously, the `EmailDeliveryJob` struct did not contain trigger information, which limited the ability to customize email content based on why a notification was sent.

This change introduces a `Triggers []JobTrigger` field to `lib/workertypes/EmailDeliveryJob` and `lib/event/emailjob/v1/EmailJobEvent`. Helper functions are added to `lib/event/emailjob/v1/types.go` for converting between internal `workertypes.JobTrigger` and `emailjob/v1.JobTrigger` types.

Additionally, the `SummaryHighlight` struct in `lib/workertypes/types.go` now includes a `MatchesTrigger` method, encapsulating the logic for checking if a highlight satisfies a given trigger. This method is then utilized in `workers/push_delivery/pkg/dispatcher/dispatcher.go` within the `matchesTrigger` function, centralizing the trigger matching logic.

The `EmailWorkerSubscriberAdapter` in `lib/gcppubsub/gcppubsubadapters/email_worker.go` and `PushDeliveryPublisher` in `lib/gcppubsub/gcppubsubadapters/push_delivery.go` are updated to correctly pass and receive these triggers. Corresponding tests have also been updated to reflect these changes.

This refactoring allows the email worker to eventually render more dynamic and personalized email content based on the specific triggers that caused the notification.
@jcscottiii jcscottiii force-pushed the jcscottiii/email-worker-pt7 branch from ec7c818 to fb69239 Compare December 31, 2025 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant