From 35fab7a23c39e385968068f71002accec95b067d Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 26 Aug 2022 22:02:40 +0200 Subject: [PATCH 1/5] fixes overwriting attributes after clicking on a relation in the attribute editor, closes #3090 --- .../app/widgets/attribute_widgets/attribute_editor.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/public/app/widgets/attribute_widgets/attribute_editor.js b/src/public/app/widgets/attribute_widgets/attribute_editor.js index bbc27fe4f..84fba78b1 100644 --- a/src/public/app/widgets/attribute_widgets/attribute_editor.js +++ b/src/public/app/widgets/attribute_widgets/attribute_editor.js @@ -297,6 +297,12 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget { } async save() { + if (this.lastUpdatedNoteId !== this.noteId) { + // https://github.com/zadam/trilium/issues/3090 + console.warn("Ignoring blur event because a different note is loaded."); + return; + } + const attributes = this.parseAttributes(); if (attributes) { @@ -354,6 +360,8 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget { } dataChanged() { + this.lastUpdatedNoteId = this.noteId; + if (this.lastSavedContent === this.textEditor.getData()) { this.$saveAttributesButton.fadeOut(); } From 5b73fe949e2cb1232d96aa5868f1cab13a31d030 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 26 Aug 2022 22:08:05 +0200 Subject: [PATCH 2/5] defensive programming, #3089 --- src/routes/api/tree.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/routes/api/tree.js b/src/routes/api/tree.js index 95cd9d1c0..7874814c2 100644 --- a/src/routes/api/tree.js +++ b/src/routes/api/tree.js @@ -97,6 +97,11 @@ function getNotesAndBranchesAndAttributes(noteIds) { for (const attributeId of collectedAttributeIds) { const attribute = becca.attributes[attributeId]; + if (!attribute) { + log.error(`Could not find attribute for attributeId=${attributeId}`); + continue; + } + attributes.push({ attributeId: attribute.attributeId, noteId: attribute.noteId, From e9090b9154f8578fa85f02113bbf4f1050638eb3 Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 23 Aug 2022 23:48:13 +0200 Subject: [PATCH 3/5] added a release flatpack script (cherry picked from commit e70a7bad1af3b3287217bc603c896226a66e9ea3) --- bin/release-flatpack.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 bin/release-flatpack.sh diff --git a/bin/release-flatpack.sh b/bin/release-flatpack.sh new file mode 100755 index 000000000..69288d78a --- /dev/null +++ b/bin/release-flatpack.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +if [[ $# -eq 0 ]] ; then + echo "Missing argument of new version" + exit 1 +fi + +VERSION=$1 + +if ! [[ ${VERSION} =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(-.+)?$ ]] ; +then + echo "Version ${VERSION} isn't in format X.Y.Z" + exit 1 +fi + +VERSION_DATE=$(git log -1 --format=%aI v${VERSION} | cut -c -10) +VERSION_COMMIT=$(git rev-list -n 1 v${VERSION}) + +echo "Updating files with version ${VERSION}, date ${VERSION_DATE} and commit ${VERSION_COMMIT}" + +# expecting the directory at a specific path +cd ~/trilium-flathub + +if ! git diff-index --quiet HEAD --; then + echo "There are uncommitted changes" + exit 1 +fi + +xmlstarlet ed --inplace --update "/component/releases/release/@version" --value "${VERSION}" --update "/component/releases/release/@date" --value "${VERSION_DATE}" ./trilium-flathub/com.github.zadam.trilium.metainfo.xml + +yq --inplace "(.modules[0].sources[0].tag = \"v${VERSION}\") | (.modules[0].sources[0].commit = \"${VERSION_COMMIT}\")" ./trilium-flathub/com.github.zadam.trilium.yml + +git commit -m "release $VERSION" +git push From 6547b66228d7b4b9e629846346d24b9a3ba4425d Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 26 Aug 2022 22:16:49 +0200 Subject: [PATCH 4/5] release 0.54.3 --- package.json | 2 +- src/services/build.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ab87a75cb..00cb4f9a8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "trilium", "productName": "Trilium Notes", "description": "Trilium Notes", - "version": "0.54.2", + "version": "0.54.3", "license": "AGPL-3.0-only", "main": "electron.js", "bin": { diff --git a/src/services/build.js b/src/services/build.js index 8e936c7ee..50d88015b 100644 --- a/src/services/build.js +++ b/src/services/build.js @@ -1 +1 @@ -module.exports = { buildDate:"2022-08-07T23:20:59+02:00", buildRevision: "3a07c5fcc059019a2330a3f6ed204eeb5df1539d" }; +module.exports = { buildDate:"2022-08-26T22:16:49+02:00", buildRevision: "e9090b9154f8578fa85f02113bbf4f1050638eb3" }; From 700e9fd912bd22b86d251be0a4cd0465f362ce2f Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 26 Aug 2022 23:52:09 +0200 Subject: [PATCH 5/5] fix release-flatpack.sh --- bin/release-flatpack.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/release-flatpack.sh b/bin/release-flatpack.sh index 69288d78a..9edc56749 100755 --- a/bin/release-flatpack.sh +++ b/bin/release-flatpack.sh @@ -26,9 +26,15 @@ if ! git diff-index --quiet HEAD --; then exit 1 fi -xmlstarlet ed --inplace --update "/component/releases/release/@version" --value "${VERSION}" --update "/component/releases/release/@date" --value "${VERSION_DATE}" ./trilium-flathub/com.github.zadam.trilium.metainfo.xml +flatpak-node-generator npm ../trilium/package-lock.json -yq --inplace "(.modules[0].sources[0].tag = \"v${VERSION}\") | (.modules[0].sources[0].commit = \"${VERSION_COMMIT}\")" ./trilium-flathub/com.github.zadam.trilium.yml +xmlstarlet ed --inplace --update "/component/releases/release/@version" --value "${VERSION}" --update "/component/releases/release/@date" --value "${VERSION_DATE}" ./com.github.zadam.trilium.metainfo.xml + +yq --inplace "(.modules[0].sources[0].tag = \"v${VERSION}\") | (.modules[0].sources[0].commit = \"${VERSION_COMMIT}\")" ./com.github.zadam.trilium.yml + +git add ./generated-sources.json +git add ./com.github.zadam.trilium.metainfo.xml +git add ./com.github.zadam.trilium.yml git commit -m "release $VERSION" git push