0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

🐛 Fixed error when deleting a member that has received a newsletter email

closes https://github.com/TryGhost/Ghost/issues/12493

- bumps `bookshelf-relations` to new version that allows for `hasMany` children to be kept when a parent record is destroyed
- adds necessary config to the `Member.email_recipients` relationship to keep related records when a member is deleted
This commit is contained in:
Kevin Ansfield 2021-01-05 14:06:20 +00:00
parent bc6df8cebe
commit eccd220461
3 changed files with 13 additions and 5 deletions

View file

@ -19,6 +19,14 @@ const Member = ghostBookshelf.Model.extend({
relationships: ['labels', 'stripeCustomers', 'email_recipients'],
// do not delete email_recipients records when a member is destroyed. Recipient
// records are used for analytics and historical records
relationshipConfig: {
email_recipients: {
destroyRelated: false
}
},
relationshipBelongsTo: {
labels: 'labels',
stripeCustomers: 'members_stripe_customers',

View file

@ -74,7 +74,7 @@
"bluebird": "3.7.2",
"body-parser": "1.19.0",
"bookshelf": "0.15.2",
"bookshelf-relations": "1.3.2",
"bookshelf-relations": "1.4.0",
"brute-knex": "4.0.1",
"bson-objectid": "1.3.1",
"bthreads": "0.5.1",

View file

@ -1366,10 +1366,10 @@ body@^5.1.0:
raw-body "~1.1.0"
safe-json-parse "~1.0.1"
bookshelf-relations@1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/bookshelf-relations/-/bookshelf-relations-1.3.2.tgz#bceb0ab3b172b01a48a81eed16cd68446975515a"
integrity sha512-LrsWiO3kKfYCTGWxCVzFuEi/hIfukRz6n3KIcQqCFaAO/PmYxFtxarMGeVKDpL/hm1BudksrK7S9vXmkfgv8eQ==
bookshelf-relations@1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/bookshelf-relations/-/bookshelf-relations-1.4.0.tgz#88f7f53b0417d99a6a2a53b386e71fd0b113df6e"
integrity sha512-l/tf4ouBw7vLmqYdyV7MvdZKROr3Cc1+7qdVF2ejqeluZ5vDxomrFH/0ftOe7c1RdJdSSxdkuZikf5QGfjqFiw==
dependencies:
bluebird "3.7.2"
ghost-ignition "4.1.0"