fix: undefined author in git commit when deleting a page (#5215)
This commit is contained in:
parent
485aa765d0
commit
559b8ae8cf
@ -787,15 +787,7 @@ module.exports = class Page extends Model {
|
|||||||
* @returns {Promise} Promise with no value
|
* @returns {Promise} Promise with no value
|
||||||
*/
|
*/
|
||||||
static async deletePage(opts) {
|
static async deletePage(opts) {
|
||||||
let page
|
const page = await WIKI.models.pages.getPageFromDb(_.has(opts, 'id') ? opts.id : opts);
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (!page) {
|
if (!page) {
|
||||||
throw new WIKI.Error.PageNotFound()
|
throw new WIKI.Error.PageNotFound()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user