Skip to content
This repository has been archived by the owner on May 19, 2021. It is now read-only.

Commit

Permalink
1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Fi1osof committed Nov 12, 2018
1 parent 978d4b0 commit 75c9616
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.2.2
===============================
- Fix uri

1.2.1
===============================
- Import Tags
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@modxclub/import-old-site",
"description": "Importer for modxclub.ru",
"version": "1.2.1",
"version": "1.2.2",
"main": "src/",
"files": [
"src"
Expand Down
27 changes: 23 additions & 4 deletions src/modules/processor/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ export default class ImportProcessor extends PrismaProcessor {

let result;

const {
let {
id,
pagetitle: name,
createdon,
Expand Down Expand Up @@ -527,6 +527,8 @@ export default class ImportProcessor extends PrismaProcessor {
contentText,
} = this.getContent(text) || {};

uri = this.prepareUri(uri);

/**
* Сохраняем объект
*/
Expand Down Expand Up @@ -666,7 +668,7 @@ export default class ImportProcessor extends PrismaProcessor {

let result;

const {
let {
id,
pagetitle: name,
createdon,
Expand All @@ -690,6 +692,8 @@ export default class ImportProcessor extends PrismaProcessor {
contentText,
} = this.getContent(text) || {};

uri = this.prepareUri(uri);

/**
* Сохраняем объект
*/
Expand Down Expand Up @@ -793,6 +797,7 @@ export default class ImportProcessor extends PrismaProcessor {

query.select([
"source.*",
"source.id as oldID",
"target_id as topicId",
"Topic.name as topicName",
"Parent.id as parentId",
Expand Down Expand Up @@ -841,8 +846,9 @@ export default class ImportProcessor extends PrismaProcessor {

let result;

const {
let {
id,
oldID,
// pagetitle: name,
createdon,
editedon,
Expand All @@ -863,7 +869,7 @@ export default class ImportProcessor extends PrismaProcessor {

let type = "Comment";

const uri = `/comments/comment-${id}.html`;
const uri = `/comments/comment-${oldID}.html`;

let {
content,
Expand Down Expand Up @@ -1082,6 +1088,19 @@ export default class ImportProcessor extends PrismaProcessor {
return root;
}

prepareUri(uri){

if(!uri){
throw new Error("uri is empty");
}

if(!uri.startsWith("/")){
uri = `/${uri}`;
}

return uri;
}

/**
* Eof Import Comments
*/
Expand Down

0 comments on commit 75c9616

Please sign in to comment.