tar import will sort notes if there is no meta file

This commit is contained in:
zadam
2019-10-06 09:49:47 +02:00
parent 516277a478
commit d23e9f1bc4
3 changed files with 26 additions and 6 deletions

View File

@@ -14,6 +14,7 @@ const commonmark = require('commonmark');
const ImportContext = require('../import_context');
const protectedSessionService = require('../protected_session');
const mimeService = require("./mime");
const treeService = require("../tree");
/**
* @param {ImportContext} importContext
@@ -426,6 +427,12 @@ async function importTar(importContext, fileBuffer, importRootNote) {
for (const noteId in createdNoteIds) { // now the noteIds are unique
await noteService.scanForLinks(noteId);
if (!metaFile) {
// if there's no meta file then the notes are created based on the order in that tar file but that
// is usually quite random so we sort the notes in the way they would appear in the file manager
await treeService.sortNotesAlphabetically(noteId, true);
}
importContext.increaseProgressCount();
}