0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Limited legacy subscriber webhook payload to v2 only (#11139)

no issue

- In v3 we don't need to support any legacy webhook formats
- Added a comment about the removal of the format when v2 is dropped
This commit is contained in:
Naz Gargol 2019-09-18 16:22:07 +02:00 committed by GitHub
parent 3b65081b5e
commit 6f9026af6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,14 +70,17 @@ module.exports = (event, model) => {
}
};
// @TODO: remove in v3
// @NOTE: Our webhook format has changed, we still have to support the old format for subscribers events
if ('subscriber.added' === event) {
payload[docName] = [current];
}
// @NOTE: Our webhook format has changed, we still have to support the old format
// for subscribers events. No need to support it passed v2 version
// @TODO: Remove whole if block when dropping Ghost v2
if (apiVersion === 'v2') {
if ('subscriber.added' === event) {
payload[docName] = [current];
}
if ('subscriber.deleted' === event) {
payload[docName] = [previous];
if ('subscriber.deleted' === event) {
payload[docName] = [previous];
}
}
return payload;