mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
256f16a01f
closes https://github.com/TryGhost/Team/issues/1150 Our override of the base Bookshelf `insert` operation so that our own `formatOnWrite()` method is called on attributes was working on a false assumption that an `attrs` attribute is passed in as it is for the `update` operation. Instead Bookshelf's base update uses the `model.attributes` values to create an `attrs` object that is then passed through the usual `.format()` method meaning that our `insert` override was not actually doing anything. - added a failing regression test for the `formatOnWrite()` override behaviour - adjusted our insert/update overrides to set an internal `_isWriting` property on the model, then if that property is true our `.format()` override (which is called by Bookshelf on a generated `attrs` object during inserts) we manually call our `.formatOnWrite()` method - updated both overrides even though `update` was working for consistency and less cognitive overhead for reasoning between two different approaches |
||
---|---|---|
.. | ||
base | ||
relations | ||
action.js | ||
api-key.js | ||
author.js | ||
benefit.js | ||
custom-theme-setting.js | ||
email-batch.js | ||
email-recipient.js | ||
email.js | ||
index.js | ||
integration.js | ||
invite.js | ||
label.js | ||
member-analytic-event.js | ||
member-email-change-event.js | ||
member-login-event.js | ||
member-paid-subscription-event.js | ||
member-payment-event.js | ||
member-product-event.js | ||
member-status-event.js | ||
member-stripe-customer.js | ||
member-subscribe-event.js | ||
member.js | ||
mobiledoc-revision.js | ||
offer-redemption.js | ||
offer.js | ||
permission.js | ||
post.js | ||
posts-meta.js | ||
product.js | ||
role.js | ||
session.js | ||
settings.js | ||
single-use-token.js | ||
snippet.js | ||
stripe-customer-subscription.js | ||
stripe-price.js | ||
stripe-product.js | ||
tag-public.js | ||
tag.js | ||
user.js | ||
webhook.js |