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

Improved forwarding model options in the API layer (#9380)

no issue

- our API layer uses a unit to combine incoming data and options
- e.g. `options.data` is the end result
- we have to take care that we don't pass data into the model layer

Credits: Olivier Arteau
This commit is contained in:
Katharina Irrgang 2018-01-09 13:26:09 +01:00 committed by GitHub
parent 430973b85b
commit dcb2aa9ad4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -285,7 +285,7 @@ authentication = {
oldPassword = data.oldPassword,
newPassword = data.newPassword;
return settingsAPI.read(_.merge({key: 'db_hash'}, options))
return settingsAPI.read(_.merge({key: 'db_hash'}, _.omit(options, 'data')))
.then(function fetchedSettings(response) {
dbHash = response.settings[0].value;

View file

@ -221,7 +221,7 @@ invites = {
}
function fetchLoggedInUser(options) {
return models.User.findOne({id: loggedInUser}, _.merge({}, options, {include: ['roles']}))
return models.User.findOne({id: loggedInUser}, _.merge({}, _.omit(options, 'data'), {include: ['roles']}))
.then(function (user) {
if (!user) {
return Promise.reject(new common.errors.NotFoundError({message: common.i18n.t('errors.api.users.userNotFound')}));