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:
parent
430973b85b
commit
dcb2aa9ad4
2 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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')}));
|
||||
|
|
Loading…
Add table
Reference in a new issue