feat: local disk import all action + v1 import content (#1100)

This commit is contained in:
Nicolas Giard
2019-10-14 23:44:37 -04:00
committed by GitHub
parent 334d0a754e
commit cffd32dee0
8 changed files with 140 additions and 51 deletions

View File

@@ -99,6 +99,8 @@ module.exports = class Editor extends Model {
switch (contentType) {
case 'markdown':
return 'markdown'
case 'html':
return 'ckeditor'
default:
return 'code'
}

View File

@@ -366,7 +366,7 @@ module.exports = class Page extends Model {
}
// -> Perform move?
if (opts.locale !== page.localeCode || opts.path !== page.path) {
if ((opts.locale && opts.locale !== page.localeCode) || (opts.path && opts.path !== page.path)) {
await WIKI.models.pages.movePage({
id: page.id,
destinationLocale: opts.locale,

View File

@@ -712,4 +712,14 @@ module.exports = class User extends Model {
user.permissions = user.getGlobalPermissions()
return user
}
static async getRootUser () {
let user = await WIKI.models.users.query().findById(1)
if (!user) {
WIKI.logger.error('CRITICAL ERROR: Root Administrator user is missing!')
process.exit(1)
}
user.permissions = ['manage:system']
return user
}
}