Browse Source
fix: undefined author in git commit when deleting a page (#5215)
pull/2933/merge
myml
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
1 additions and
9 deletions
-
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() |
|
|
|
} |
|
|
|