0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/server/models
Kevin Ansfield 256f16a01f
🐛 Fixed URLs not being correctly transformed during insert operations (#13618)
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
2021-10-20 15:22:46 +01:00
..
base 🐛 Fixed URLs not being correctly transformed during insert operations (#13618) 2021-10-20 15:22:46 +01:00
relations Replaced i18n.t w/ tpl in core/server/models (#13464) 2021-10-06 11:43:54 +01:00
action.js Removed explicit loading of Bookshelf registry plugin 2021-09-10 16:59:11 +01:00
api-key.js Updated signature of Bookshelf model listeners 2021-09-10 16:59:11 +01:00
author.js
benefit.js
custom-theme-setting.js Removed errant console.log 2021-10-14 20:38:02 +01:00
email-batch.js
email-recipient.js
email.js Updated signature of Bookshelf model listeners 2021-09-10 16:59:11 +01:00
index.js Added OfferRedemption model 2021-10-15 16:56:04 +02:00
integration.js Updated signature of Bookshelf model listeners 2021-09-10 16:59:11 +01:00
invite.js Replaced i18n.t w/ tpl in core/server/models (#13464) 2021-10-06 11:43:54 +01:00
label.js Replaced i18n.t w/ tpl in core/server/models (#13464) 2021-10-06 11:43:54 +01:00
member-analytic-event.js Added temporary database table for analytic events (#13312) 2021-09-17 11:15:21 +02:00
member-email-change-event.js
member-login-event.js
member-paid-subscription-event.js
member-payment-event.js
member-product-event.js Added MemberProductEvent model & relations 2021-08-24 14:44:53 +02:00
member-status-event.js
member-stripe-customer.js
member-subscribe-event.js
member.js Updated signature of Bookshelf model listeners 2021-09-10 16:59:11 +01:00
mobiledoc-revision.js
offer-redemption.js Added OfferRedemption model 2021-10-15 16:56:04 +02:00
offer.js Added model for offers table 2021-10-04 12:03:36 +05:30
permission.js
post.js Replaced i18n.t w/ tpl in core/server/models (#13464) 2021-10-06 11:43:54 +01:00
posts-meta.js Added email_only column to posts_meta table 2021-08-05 19:44:35 +12:00
product.js Ordered Products by their monthly price by default (#13234) 2021-08-20 14:46:06 +02:00
role.js Replaced i18n.t w/ tpl in core/server/models (#13464) 2021-10-06 11:43:54 +01:00
session.js
settings.js Replaced i18n.t w/ tpl in core/server/models (#13464) 2021-10-06 11:43:54 +01:00
single-use-token.js
snippet.js
stripe-customer-subscription.js
stripe-price.js
stripe-product.js
tag-public.js
tag.js Replaced i18n.t w/ tpl in core/server/models (#13464) 2021-10-06 11:43:54 +01:00
user.js Replaced i18n.t w/ tpl in core/server/models/user (#13459) 2021-10-06 10:16:57 +01:00
webhook.js Updated signature of Bookshelf model listeners 2021-09-10 16:59:11 +01:00