various script fixes, including for electron

This commit is contained in:
azivner
2018-01-30 22:44:46 -05:00
parent 72bd2507fe
commit 8249a81c77
6 changed files with 13 additions and 11 deletions

View File

@@ -64,7 +64,7 @@ class Repository {
entity.beforeSaving();
}
const clone = {...entity};
const clone = Object.assign({}, entity);
delete clone.dataKey;
delete clone.jsonContent;

View File

@@ -2,10 +2,10 @@ const log = require('./log');
const sql = require('./sql');
const ScriptContext = require('./script_context');
async function executeScript(noteId, dataKey, script, params) {
async function executeScript(dataKey, script, params) {
log.info('Executing script: ' + script);
const ctx = new ScriptContext(noteId, dataKey);
const ctx = new ScriptContext(dataKey);
const paramsStr = getParams(params);

View File

@@ -6,7 +6,6 @@ const date_notes = require('./date_notes');
const Repository = require('./repository');
function ScriptContext(noteId, dataKey) {
this.scriptNoteId = noteId;
this.dataKey = protected_session.getDataKey(dataKey);
this.repository = new Repository(dataKey);
@@ -58,7 +57,7 @@ function ScriptContext(noteId, dataKey) {
this.updateEntity = this.repository.updateEntity;
this.log = function(message) {
log.info(`Script ${this.scriptNoteId}: ${message}`);
log.info(`Script: ${message}`);
};
this.getDateNoteId = date_notes.getDateNoteId;