fix: undefined author in git commit when deleting a page (#5215)

This commit is contained in:
myml
2022-05-20 19:19:55 -04:00
committed by Nicolas Giard
parent 948157745f
commit 64104f81ad
+1 -9
View File
@@ -773,15 +773,7 @@ module.exports = class Page extends Model {
* @returns {Promise} Promise with no value
*/
static async deletePage(opts) {
let page
if (_.has(opts, 'id')) {
page = await WIKI.models.pages.query().findById(opts.id)
} else {
page = await WIKI.models.pages.query().findOne({
path: opts.path,
localeCode: opts.locale
})
}
const page = await WIKI.models.pages.getPageFromDb(_.has(opts, 'id') ? opts.id : opts);
if (!page) {
throw new WIKI.Error.PageNotFound()
}