0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Disabled autoRefresh for inserted Actions events

- we don't end up using the inserted model from Bookshelf, so we
  shouldn't be performing a SELECT on the entry
- this disables refreshing the model using Bookshelf's `autoRefresh:
  false` and allows the key through the sanitization for `add
This commit is contained in:
Daniel Lockyer 2023-01-19 09:27:10 +01:00
parent 150f2f8a5f
commit f45bba21f6
No known key found for this signature in database
2 changed files with 3 additions and 1 deletions

View file

@ -93,7 +93,7 @@ module.exports = function (Bookshelf) {
const insert = (action) => {
Bookshelf.model('Action')
.add(action)
.add(action, {autoRefresh: false})
.catch((err) => {
if (_.isArray(err)) {
err = err[0];

View file

@ -38,6 +38,8 @@ module.exports = function (Bookshelf) {
return baseOptions.concat('shallow', 'columns', 'previous');
case 'destroy':
return baseOptions.concat(extraOptions, ['id', 'destroyBy', 'require']);
case 'add':
return baseOptions.concat(extraOptions, ['autoRefresh']);
case 'edit':
return baseOptions.concat(extraOptions, ['id', 'require']);
case 'findOne':