Include collectionId in revisions.create webhook payload
This commit is contained in:
@@ -515,16 +515,26 @@ export default class DeliverWebhookTask extends BaseTask<Props> {
|
|||||||
subscription: WebhookSubscription,
|
subscription: WebhookSubscription,
|
||||||
event: RevisionEvent
|
event: RevisionEvent
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const model = await Revision.findByPk(event.modelId, {
|
const [model, document] = await Promise.all([
|
||||||
paranoid: false,
|
Revision.findByPk(event.modelId, {
|
||||||
});
|
paranoid: false,
|
||||||
|
}),
|
||||||
|
Document.findByPk(event.documentId, {
|
||||||
|
paranoid: false,
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
...(model ? await presentRevision(model) : {}),
|
||||||
|
collectionId: document ? document.collectionId : undefined,
|
||||||
|
};
|
||||||
|
|
||||||
await this.sendWebhook({
|
await this.sendWebhook({
|
||||||
event,
|
event,
|
||||||
subscription,
|
subscription,
|
||||||
payload: {
|
payload: {
|
||||||
id: event.modelId,
|
id: event.modelId,
|
||||||
model: model && (await presentRevision(model)),
|
model: data,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user