Skip to content

Build your personal knowledge base with Trilium Notes

server-ts: Address requested changes

Elian Doranfb32ab970713
diff --git a/src/services/import/zip.ts b/src/services/import/zip.ts
index cda7347aad..b7b39aa8cd 100644
--- a/src/services/import/zip.ts
+++ b/src/services/import/zip.ts
@@ -239,8 +239,8 @@ async function importZip(taskContext: TaskContext, fileBuffer: Buffer, importRoo
noteId: noteId,
type: resolveNoteType(noteMeta?.type),
mime: noteMeta ? noteMeta.mime : 'text/html',
- prefix: noteMeta ? noteMeta.prefix || "" : '',
- isExpanded: noteMeta ? noteMeta.isExpanded : false,
+ prefix: noteMeta?.prefix || '',
+ isExpanded: !!noteMeta?.isExpanded,
notePosition: (noteMeta && firstNote) ? noteMeta.notePosition : undefined,
isProtected: importRootNote.isProtected && protectedSessionService.isProtectedSessionAvailable(),
});
@@ -510,8 +510,8 @@ async function importZip(taskContext: TaskContext, fileBuffer: Buffer, importRoo
noteId,
type,
mime,
- prefix: noteMeta ? noteMeta.prefix || "" : '',
- isExpanded: noteMeta ? noteMeta.isExpanded : false,
+ prefix: noteMeta?.prefix || '',
+ isExpanded: !!noteMeta?.isExpanded,
// root notePosition should be ignored since it relates to the original document
// now import root should be placed after existing notes into new parent
notePosition: (noteMeta && firstNote) ? noteMeta.notePosition : undefined,
diff --git a/src/services/script.ts b/src/services/script.ts
index 1df79290e1..9054ff75b1 100644
--- a/src/services/script.ts
+++ b/src/services/script.ts
@@ -102,7 +102,7 @@ function executeScript(script: string, params: ScriptParams, startNoteId: string
return executeBundle(bundle, { startNote, originEntity });
}
-function execute(ctx: any, script: string) {
+function execute(ctx: ScriptContext, script: string) {
return function () { return eval(`const apiContext = this;\r\n(${script}\r\n)()`); }.call(ctx);
}