diff --git a/core/client b/core/client index a2517f3190..4c4fcdad48 160000 --- a/core/client +++ b/core/client @@ -1 +1 @@ -Subproject commit a2517f3190e9ee77ef0e7fef5372fae43356c002 +Subproject commit 4c4fcdad486670e9202f8ca22f77c4333c3bb3ec diff --git a/core/server/api/canary/snippets.js b/core/server/api/canary/snippets.js index 71ffa9b8b4..3e8bb0d0a1 100644 --- a/core/server/api/canary/snippets.js +++ b/core/server/api/canary/snippets.js @@ -97,6 +97,8 @@ module.exports = { }, permissions: true, query(frame) { + frame.options.require = true; + return models.Snippet.destroy(frame.options) .then(() => null) .catch(models.Snippet.NotFoundError, () => { diff --git a/core/server/api/v3/snippets.js b/core/server/api/v3/snippets.js index 71ffa9b8b4..3e8bb0d0a1 100644 --- a/core/server/api/v3/snippets.js +++ b/core/server/api/v3/snippets.js @@ -97,6 +97,8 @@ module.exports = { }, permissions: true, query(frame) { + frame.options.require = true; + return models.Snippet.destroy(frame.options) .then(() => null) .catch(models.Snippet.NotFoundError, () => { diff --git a/core/server/models/base/plugins/crud.js b/core/server/models/base/plugins/crud.js index 60a5b69d3c..ec813537fa 100644 --- a/core/server/models/base/plugins/crud.js +++ b/core/server/models/base/plugins/crud.js @@ -198,7 +198,7 @@ module.exports = function (Bookshelf) { * @param {Object} [unfilteredOptions] * @return {Promise} Empty Model */ - destroy: async function destroy(unfilteredOptions) { + destroy: function destroy(unfilteredOptions) { const options = this.filterOptions(unfilteredOptions, 'destroy'); if (!options.destroyBy) { @@ -208,8 +208,11 @@ module.exports = function (Bookshelf) { } // Fetch the object before destroying it, so that the changed data is available to events - const obj = await this.forge(options.destroyBy).fetch(options); - return obj.destroy(options); + return this.forge(options.destroyBy) + .fetch(options) + .then(function then(obj) { + return obj.destroy(options); + }); }, // When loading an instance, subclasses can specify default to fetch diff --git a/package.json b/package.json index 36ce751dd2..8f28b527e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghost", - "version": "4.8.0", + "version": "4.8.1", "description": "The professional publishing platform", "author": "Ghost Foundation", "homepage": "https://ghost.org",