mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Replaced use of Bluebird return method from knex code
no issue - Knex removed their use of several Bluebird methods, including `return` - our code used `return`, but mostly to return null after a destroy action - these uses have been replaced with `.then(() => null)` in order to continue returning null and to avoid breaking anything
This commit is contained in:
parent
3ebae36c0a
commit
13e1ecae27
@ -77,7 +77,7 @@ module.exports = {
|
||||
frame.options.require = true;
|
||||
|
||||
return models.Invite.destroy(frame.options)
|
||||
.return(null);
|
||||
.then(() => null);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -139,7 +139,7 @@ module.exports = {
|
||||
},
|
||||
permissions: true,
|
||||
query(frame) {
|
||||
return models.Label.destroy(frame.options).return(null);
|
||||
return models.Label.destroy(frame.options).then(() => null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -196,7 +196,7 @@ module.exports = {
|
||||
frame.options.require = true;
|
||||
|
||||
return models.Post.destroy(frame.options)
|
||||
.return(null)
|
||||
.then(() => null)
|
||||
.catch(models.Post.NotFoundError, () => {
|
||||
throw new common.errors.NotFoundError({
|
||||
message: common.i18n.t('errors.api.pages.pageNotFound')
|
||||
|
@ -231,7 +231,7 @@ module.exports = {
|
||||
frame.options.require = true;
|
||||
|
||||
return models.Post.destroy(frame.options)
|
||||
.return(null)
|
||||
.then(() => null)
|
||||
.catch(models.Post.NotFoundError, () => {
|
||||
throw new common.errors.NotFoundError({
|
||||
message: common.i18n.t('errors.api.posts.postNotFound')
|
||||
|
@ -142,7 +142,7 @@ module.exports = {
|
||||
},
|
||||
permissions: true,
|
||||
query(frame) {
|
||||
return models.Tag.destroy(frame.options).return(null);
|
||||
return models.Tag.destroy(frame.options).then(() => null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -130,11 +130,11 @@ module.exports = {
|
||||
return models.Base.transaction((t) => {
|
||||
frame.options.transacting = t;
|
||||
|
||||
return Promise.all([
|
||||
models.Post.destroyByAuthor(frame.options)
|
||||
]).then(() => {
|
||||
return models.User.destroy(Object.assign({status: 'all'}, frame.options));
|
||||
}).return(filename);
|
||||
return models.Post.destroyByAuthor(frame.options)
|
||||
.then(() => {
|
||||
return models.User.destroy(Object.assign({status: 'all'}, frame.options));
|
||||
})
|
||||
.then(() => filename);
|
||||
}).catch((err) => {
|
||||
return Promise.reject(new common.errors.NoPermissionError({
|
||||
err: err
|
||||
|
@ -84,7 +84,7 @@ module.exports = {
|
||||
permissions: true,
|
||||
query(frame) {
|
||||
frame.options.require = true;
|
||||
return models.Webhook.destroy(frame.options).return(null);
|
||||
return models.Webhook.destroy(frame.options).then(() => null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -77,7 +77,7 @@ module.exports = {
|
||||
frame.options.require = true;
|
||||
|
||||
return models.Invite.destroy(frame.options)
|
||||
.return(null);
|
||||
.then(() => null);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -196,7 +196,7 @@ module.exports = {
|
||||
frame.options.require = true;
|
||||
|
||||
return models.Post.destroy(frame.options)
|
||||
.return(null)
|
||||
.then(() => null)
|
||||
.catch(models.Post.NotFoundError, () => {
|
||||
throw new common.errors.NotFoundError({
|
||||
message: common.i18n.t('errors.api.pages.pageNotFound')
|
||||
|
@ -191,7 +191,7 @@ module.exports = {
|
||||
frame.options.require = true;
|
||||
|
||||
return models.Post.destroy(frame.options)
|
||||
.return(null)
|
||||
.then(() => null)
|
||||
.catch(models.Post.NotFoundError, () => {
|
||||
throw new common.errors.NotFoundError({
|
||||
message: common.i18n.t('errors.api.posts.postNotFound')
|
||||
|
@ -142,7 +142,7 @@ module.exports = {
|
||||
},
|
||||
permissions: true,
|
||||
query(frame) {
|
||||
return models.Tag.destroy(frame.options).return(null);
|
||||
return models.Tag.destroy(frame.options).then(() => null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -129,7 +129,7 @@ module.exports = {
|
||||
models.Post.destroyByAuthor(frame.options)
|
||||
]).then(() => {
|
||||
return models.User.destroy(Object.assign({status: 'all'}, frame.options));
|
||||
}).return(null);
|
||||
}).then(() => null);
|
||||
}).catch((err) => {
|
||||
return Promise.reject(new common.errors.NoPermissionError({
|
||||
err: err
|
||||
|
@ -84,7 +84,7 @@ module.exports = {
|
||||
permissions: true,
|
||||
query(frame) {
|
||||
frame.options.require = true;
|
||||
return models.Webhook.destroy(frame.options).return(null);
|
||||
return models.Webhook.destroy(frame.options).then(() => null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -314,7 +314,7 @@ module.exports.extendModel = function extendModel(Post, Posts, ghostBookshelf) {
|
||||
return (options.transacting || ghostBookshelf.knex)('posts_authors')
|
||||
.where('author_id', authorId)
|
||||
.del()
|
||||
.return(response);
|
||||
.then(() => response);
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new common.errors.GhostError({err: err});
|
||||
|
Loading…
Reference in New Issue
Block a user