Compare commits

...

5 Commits

Author SHA1 Message Date
zadam
47d61c416d release 0.45.4 2020-11-12 22:15:23 +01:00
zadam
6c57b2220f fix export download, fixes #1411 2020-11-12 22:13:59 +01:00
zadam
99f01b9ccf fix overwriting / deleting auto links, closes #1406 2020-11-11 23:15:48 +01:00
zadam
d5a9abd911 fix duplicating relations after change, closes #1405 2020-11-11 23:02:14 +01:00
zadam
a3a2bc0a74 fix "reviving" deleted attributes, closes #1404 2020-11-11 22:44:13 +01:00
6 changed files with 18 additions and 8 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "trilium", "name": "trilium",
"version": "0.45.2", "version": "0.45.3",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -2,7 +2,7 @@
"name": "trilium", "name": "trilium",
"productName": "Trilium Notes", "productName": "Trilium Notes",
"description": "Trilium Notes", "description": "Trilium Notes",
"version": "0.45.3", "version": "0.45.4",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"main": "electron.js", "main": "electron.js",
"bin": { "bin": {

View File

@@ -34,6 +34,10 @@ class Attribute extends Entity {
this.isInheritable = !!this.isInheritable; this.isInheritable = !!this.isInheritable;
} }
isAutoLink() {
return this.type === 'relation' && ['internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink'].includes(this.name);
}
/** /**
* @returns {Note|null} * @returns {Note|null}
*/ */

View File

@@ -64,6 +64,7 @@ function getHost() {
} }
export default { export default {
download,
downloadFileNote, downloadFileNote,
openFileNote, openFileNote,
downloadNoteRevision, downloadNoteRevision,

View File

@@ -28,8 +28,10 @@ function updateNoteAttribute(req) {
|| body.name !== attribute.name || body.name !== attribute.name
|| (body.type === 'relation' && body.value !== attribute.value)) { || (body.type === 'relation' && body.value !== attribute.value)) {
let newAttribute;
if (body.type !== 'relation' || !!body.value.trim()) { if (body.type !== 'relation' || !!body.value.trim()) {
const newAttribute = attribute.createClone(body.type, body.name, body.value); newAttribute = attribute.createClone(body.type, body.name, body.value);
newAttribute.save(); newAttribute.save();
} }
@@ -37,7 +39,7 @@ function updateNoteAttribute(req) {
attribute.save(); attribute.save();
return { return {
attributeId: attribute.attributeId attributeId: newAttribute ? newAttribute.attributeId : null
}; };
} }
} }
@@ -52,8 +54,9 @@ function updateNoteAttribute(req) {
attribute.type = body.type; attribute.type = body.type;
} }
if (body.value.trim()) { if (body.type !== 'relation' || body.value.trim()) {
attribute.value = body.value; attribute.value = body.value;
attribute.isDeleted = false;
} }
else { else {
// relations should never have empty target // relations should never have empty target
@@ -144,9 +147,11 @@ function updateNoteAttributes(req) {
// all the remaining existing attributes are not defined anymore and should be deleted // all the remaining existing attributes are not defined anymore and should be deleted
for (const toDeleteAttr of existingAttrs) { for (const toDeleteAttr of existingAttrs) {
if (!toDeleteAttr.isAutoLink()) {
toDeleteAttr.isDeleted = true; toDeleteAttr.isDeleted = true;
toDeleteAttr.save(); toDeleteAttr.save();
} }
}
} }
function getAttributeNames(req) { function getAttributeNames(req) {

View File

@@ -1 +1 @@
module.exports = { buildDate:"2020-11-10T22:54:39+01:00", buildRevision: "5157fc15e9f7fa960ee35685426868d5599933dc" }; module.exports = { buildDate:"2020-11-12T22:15:23+01:00", buildRevision: "6c57b2220ff05059d7460369b195d281fcd9cbb6" };