0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40: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 Added Benefit model 2021-06-29 16:53:15 +01:00
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 Added member relation to events (#12656) 2021-02-16 16:14:20 +00:00
member-login-event.js Added member relation to events (#12656) 2021-02-16 16:14:20 +00:00
member-paid-subscription-event.js Added member relation to events (#12656) 2021-02-16 16:14:20 +00:00
member-payment-event.js Added member relation to events (#12656) 2021-02-16 16:14:20 +00:00
member-product-event.js Added MemberProductEvent model & relations 2021-08-24 14:44:53 +02:00
member-status-event.js Readded support for comped status in event aggregate (#13142) 2021-07-15 15:17:51 +01:00
member-stripe-customer.js
member-subscribe-event.js Added member relation to events (#12656) 2021-02-16 16:14:20 +00:00
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 🔒 Added a "reset all passwords" feature (#13005) 2021-06-23 14:54:28 +02:00
settings.js Replaced i18n.t w/ tpl in core/server/models (#13464) 2021-10-06 11:43:54 +01:00
single-use-token.js Change to use @tryghost/logging 2021-06-15 15:59:11 +01:00
snippet.js Fixed no-restricted-require warning for core/shared/url-utils.js 2021-05-25 21:13:57 +01:00
stripe-customer-subscription.js 🐛 Fixed members list not loading (#12930) 2021-05-26 19:52:42 +05:30
stripe-price.js Added models for stripe prices and products 2021-04-12 21:53:59 +05:30
stripe-product.js Added Product, StripeProduct & StripePrice relations (#12877) 2021-04-14 19:20:39 +01:00
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