mirror of
https://github.com/zadam/trilium.git
synced 2025-10-26 15:56:29 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47d61c416d | ||
|
|
6c57b2220f | ||
|
|
99f01b9ccf | ||
|
|
d5a9abd911 | ||
|
|
a3a2bc0a74 |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "trilium",
|
||||
"version": "0.45.2",
|
||||
"version": "0.45.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "trilium",
|
||||
"productName": "Trilium Notes",
|
||||
"description": "Trilium Notes",
|
||||
"version": "0.45.3",
|
||||
"version": "0.45.4",
|
||||
"license": "AGPL-3.0-only",
|
||||
"main": "electron.js",
|
||||
"bin": {
|
||||
|
||||
@@ -34,6 +34,10 @@ class Attribute extends Entity {
|
||||
this.isInheritable = !!this.isInheritable;
|
||||
}
|
||||
|
||||
isAutoLink() {
|
||||
return this.type === 'relation' && ['internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink'].includes(this.name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Note|null}
|
||||
*/
|
||||
|
||||
@@ -64,6 +64,7 @@ function getHost() {
|
||||
}
|
||||
|
||||
export default {
|
||||
download,
|
||||
downloadFileNote,
|
||||
openFileNote,
|
||||
downloadNoteRevision,
|
||||
|
||||
@@ -28,8 +28,10 @@ function updateNoteAttribute(req) {
|
||||
|| body.name !== attribute.name
|
||||
|| (body.type === 'relation' && body.value !== attribute.value)) {
|
||||
|
||||
let newAttribute;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -37,7 +39,7 @@ function updateNoteAttribute(req) {
|
||||
attribute.save();
|
||||
|
||||
return {
|
||||
attributeId: attribute.attributeId
|
||||
attributeId: newAttribute ? newAttribute.attributeId : null
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -52,8 +54,9 @@ function updateNoteAttribute(req) {
|
||||
attribute.type = body.type;
|
||||
}
|
||||
|
||||
if (body.value.trim()) {
|
||||
if (body.type !== 'relation' || body.value.trim()) {
|
||||
attribute.value = body.value;
|
||||
attribute.isDeleted = false;
|
||||
}
|
||||
else {
|
||||
// relations should never have empty target
|
||||
@@ -144,8 +147,10 @@ function updateNoteAttributes(req) {
|
||||
|
||||
// all the remaining existing attributes are not defined anymore and should be deleted
|
||||
for (const toDeleteAttr of existingAttrs) {
|
||||
toDeleteAttr.isDeleted = true;
|
||||
toDeleteAttr.save();
|
||||
if (!toDeleteAttr.isAutoLink()) {
|
||||
toDeleteAttr.isDeleted = true;
|
||||
toDeleteAttr.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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" };
|
||||
|
||||
Reference in New Issue
Block a user