From 559b8ae8cf9b3dea8c7a03ec988f4fff6f8f4a13 Mon Sep 17 00:00:00 2001 From: myml Date: Sun, 1 May 2022 11:26:06 +0800 Subject: [PATCH] fix: undefined author in git commit when deleting a page (#5215) --- server/models/pages.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/server/models/pages.js b/server/models/pages.js index 72c063fa..44b3825f 100644 --- a/server/models/pages.js +++ b/server/models/pages.js @@ -787,15 +787,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() }