Ghost/core/server/models
kirrg001 355ef54702 Removed isNew usages in model layer
no issue

- `isNew` does not work in Ghost, because Ghost does not use auto increment id's
- see https://github.com/bookshelf/bookshelf/issues/1265
- see https://github.com/bookshelf/bookshelf/blob/0.10.3/src/base/model.js#L211
- we only had one occurance, which was anyway redundant
  - if you add a user, `hasChanged('password') is true
  - if you edit a user and the password has changed, `hasChanged('password')` is true as well

NOTE #1:

1. We can't override `isNew` and throw an error, because bookshelf makes use of `isNew` as well, but it's a fallback if `options.method` is not set.
2. It's hard to re-implement `isNew` based on `options.method`, because then we need to ensure that this value is always set (requires a couple of changes)

NOTE #2:
If we need to differentiate if a model is new or edited, we should manually check for `options.method === insert`.

NOTE #3:
The unit tests are much faster compared to the model integration tests.
I did a comparision with the same test assertion:
  - unit test takes 70ms
  - integration test takes 190ms
2018-02-15 22:11:49 +01:00
..
base Sorted out the mixed usages of include and withRelated (#9425) 2018-02-15 10:53:53 +01:00
plugins Sorted out the mixed usages of include and withRelated (#9425) 2018-02-15 10:53:53 +01:00
accesstoken.js Import lib/common only 2017-12-12 10:28:13 +01:00
app-field.js Misc cleanup: moving files & naming functions 2015-06-15 09:43:19 +01:00
app-setting.js Misc cleanup: moving files & naming functions 2015-06-15 09:43:19 +01:00
app.js Switch to Eslint (#9197) 2017-11-01 13:44:54 +00:00
client-trusted-domain.js Add table columns for OAuth 2015-09-02 13:39:22 +01:00
client.js 🎨 😎 config env usages (#7929) 2017-02-03 18:25:39 +00:00
index.js Webhooks support for subscriber events (#9230) 2017-11-21 15:43:14 +00:00
invite.js Sorted out the mixed usages of include and withRelated (#9425) 2018-02-15 10:53:53 +01:00
permission.js Misc cleanup: moving files & naming functions 2015-06-15 09:43:19 +01:00
post.js Sorted out the mixed usages of include and withRelated (#9425) 2018-02-15 10:53:53 +01:00
refreshtoken.js Misc cleanup: moving files & naming functions 2015-06-15 09:43:19 +01:00
role.js Contributor Role (#9315) 2018-02-07 10:46:22 +01:00
settings.js Sorted out the mixed usages of include and withRelated (#9425) 2018-02-15 10:53:53 +01:00
subscriber.js Sorted out the mixed usages of include and withRelated (#9425) 2018-02-15 10:53:53 +01:00
tag.js Sorted out the mixed usages of include and withRelated (#9425) 2018-02-15 10:53:53 +01:00
user.js Removed isNew usages in model layer 2018-02-15 22:11:49 +01:00
webhook.js Sorted out the mixed usages of include and withRelated (#9425) 2018-02-15 10:53:53 +01:00