Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/options: make the "keep named revisions" option to default to true
Adorian Doran25aea4443ec6
diff --git a/packages/trilium-core/src/becca/entities/bnote_content.spec.ts b/packages/trilium-core/src/becca/entities/bnote_content.spec.tsindex fe413928e8..ca4c95e63c 100644--- a/packages/trilium-core/src/becca/entities/bnote_content.spec.ts+++ b/packages/trilium-core/src/becca/entities/bnote_content.spec.ts@@ -592,20 +592,24 @@ describe("BNote content / misc getters", () => {const [ , , , , newest ] = createRevisions(note,[ undefined, "release", undefined, "before the refactor", undefined ]);- expect(eraseExcess(note, { snapshotsToKeep: 1 })).toBe(4);+ expect(eraseExcess(note, { snapshotsToKeep: 1, keepNamedSnapshots: false })).toBe(4);expect(revisionIdsOf(note)).toEqual([ newest ]);});- it("spares named snapshots by the configured option when the caller says nothing", () => {+ it("follows the configured option when the caller says nothing either way", () => {const note = createNote();const [ , named, newest ] = createRevisions(note, [ undefined, "release", undefined ]);- getContext().init(() => optionService.setOption("revisionIgnoreNamedSnapshots", "true"));+ // Named snapshots are spared out of the box.+ expect(eraseExcess(note, { snapshotsToKeep: 1 })).toBe(1);+ expect(revisionIdsOf(note)).toEqual([ named, newest ]);++ getContext().init(() => optionService.setOption("revisionIgnoreNamedSnapshots", "false"));try {expect(eraseExcess(note, { snapshotsToKeep: 1 })).toBe(1);- expect(revisionIdsOf(note)).toEqual([ named, newest ]);+ expect(revisionIdsOf(note)).toEqual([ newest ]);} finally {- getContext().init(() => optionService.setOption("revisionIgnoreNamedSnapshots", "false"));+ getContext().init(() => optionService.setOption("revisionIgnoreNamedSnapshots", "true"));}});});diff --git a/packages/trilium-core/src/services/options_init.ts b/packages/trilium-core/src/services/options_init.tsindex 5799c0c93b..65e95ee5a8 100644--- a/packages/trilium-core/src/services/options_init.ts+++ b/packages/trilium-core/src/services/options_init.ts@@ -149,7 +149,7 @@ const defaultOptions: DefaultOption[] = [{ name: "revisionSnapshotTimeInterval", value: "600", isSynced: true },{ name: "revisionSnapshotTimeIntervalTimeScale", value: "60", isSynced: true }, // default to Minutes{ name: "revisionSnapshotNumberLimit", value: "-1", isSynced: true },- { name: "revisionIgnoreNamedSnapshots", value: "false", isSynced: true },+ { name: "revisionIgnoreNamedSnapshots", value: "true", isSynced: true },{ name: "protectedSessionTimeout", value: "600", isSynced: true },{ name: "protectedSessionTimeoutTimeScale", value: "60", isSynced: true },{ name: "zoomFactor", value: () => isWindows() ? "0.9" : "1.0", isSynced: false },