From 1f3f9a4037b5aa9dcb4a9445a89d87f4538e3cbe Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 10 Nov 2019 22:20:54 +0100 Subject: [PATCH 1/2] release 0.36.5 --- package.json | 2 +- src/services/build.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4167d3bc2..d3596e69a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "trilium", "productName": "Trilium Notes", "description": "Trilium Notes", - "version": "0.36.4", + "version": "0.36.5", "license": "AGPL-3.0-only", "main": "electron.js", "bin": { diff --git a/src/services/build.js b/src/services/build.js index 459680264..f088864e7 100644 --- a/src/services/build.js +++ b/src/services/build.js @@ -1 +1 @@ -module.exports = { buildDate:"2019-11-09T21:19:34+01:00", buildRevision: "c2ebd4b308d712b3f4cff99019c559ccab0e49b7" }; +module.exports = { buildDate:"2019-11-10T22:20:54+01:00", buildRevision: "b5a0cadcf45e51377573c12b939a1654b09f4931" }; From a808e12d31be5dc56e717ddb2eb0a8fc4ea18d41 Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 11 Nov 2019 20:42:03 +0100 Subject: [PATCH 2/2] fix .setAttribute in stable, #703 --- src/entities/note.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/entities/note.js b/src/entities/note.js index b2f7a4b11..e74255596 100644 --- a/src/entities/note.js +++ b/src/entities/note.js @@ -419,7 +419,7 @@ class Note extends Entity { } /** - * Creates given attribute name-value pair if it doesn't exist. + * Update's given attribute's value or creates it if it doesn't exist * * @param {string} type - attribute type (label, relation, etc.) * @param {string} name - attribute name @@ -428,9 +428,17 @@ class Note extends Entity { */ async setAttribute(type, name, value) { const attributes = await this.getOwnedAttributes(); - let attr = attributes.find(attr => attr.type === type && (value === undefined || attr.value === value)); + let attr = attributes.find(attr => attr.type === type && attr.name === name); - if (!attr) { + if (attr) { + if (attr.value !== value) { + attr.value = value; + await attr.save(); + + this.invalidateAttributeCache(); + } + } + else { attr = new Attribute({ noteId: this.noteId, type: type, @@ -532,7 +540,7 @@ class Note extends Entity { async toggleRelation(enabled, name, value) { return await this.toggleAttribute(RELATION, enabled, name, value); } /** - * Create label name-value pair if it doesn't exist yet. + * Update's given label's value or creates it if it doesn't exist * * @param {string} name - label name * @param {string} [value] - label value @@ -541,7 +549,7 @@ class Note extends Entity { async setLabel(name, value) { return await this.setAttribute(LABEL, name, value); } /** - * Create relation name-value pair if it doesn't exist yet. + * Update's given relation's value or creates it if it doesn't exist * * @param {string} name - relation name * @param {string} [value] - relation value (noteId)