M api/graph/schema.resolvers.go => api/graph/schema.resolvers.go +7 -0
@@ 1288,6 1288,13 @@ func (r *mutationResolver) TriggerUserEmailWebhooks(ctx context.Context, emailID
return nil, err
}
webhooks.DeliverUserEmailEvent(ctx, model.WebhookEventEmailReceived, email)
+ if email.PatchsetID != nil {
+ patchset, err := loaders.ForContext(ctx).PatchsetsByID.Load(*email.PatchsetID)
+ if err != nil {
+ return nil, err
+ }
+ webhooks.DeliverUserPatchsetEvent(ctx, model.WebhookEventPatchsetReceived, patchset)
+ }
return email, nil
}
M api/webhooks/webhooks.go => api/webhooks/webhooks.go +12 -0
@@ 73,6 73,18 @@ func DeliverUserEmailEvent(ctx context.Context,
deliverUserWebhook(ctx, event, &payload, payloadUUID)
}
+func DeliverUserPatchsetEvent(ctx context.Context,
+ event model.WebhookEvent, patchset *model.Patchset) {
+ payloadUUID := uuid.New()
+ payload := model.PatchsetEvent{
+ UUID: payloadUUID.String(),
+ Event: event,
+ Date: time.Now().UTC(),
+ Patchset: patchset,
+ }
+ deliverUserWebhook(ctx, event, &payload, payloadUUID)
+}
+
func DeliverMailingListEvent(ctx context.Context,
event model.WebhookEvent, list *model.MailingList) {
payloadUUID := uuid.New()