An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Upgrade attribute view spec to version 7 https://github.com/siyuan-note/siyuan/issues/18539
Daniel2dc21f5ff03f
diff --git a/kernel/av/av_fix.go b/kernel/av/av_fix.goindex 7a9105c60c..971cd8ce1b 100644--- a/kernel/av/av_fix.go+++ b/kernel/av/av_fix.go@@ -24,7 +24,7 @@ import ("github.com/siyuan-note/siyuan/kernel/util")-const CurrentSpec = 6+const CurrentSpec = 7const MaxFilterNestingDepth = 3@@ -39,6 +39,7 @@ func UpgradeSpec(av *AttributeView) {upgradeSpec4(av)upgradeSpec5(av)upgradeSpec6(av)+ upgradeSpec7(av)}func CheckSpec(av *AttributeView) (err error) {@@ -50,6 +51,16 @@ func CheckSpec(av *AttributeView) (err error) {return}+// upgradeSpec7 移除数据库级当前视图,当前视图由数据库块属性或调用上下文决定。+// https://github.com/siyuan-note/siyuan/issues/18539+func upgradeSpec7(av *AttributeView) {+ if 7 <= av.Spec {+ return+ }++ av.Spec = 7+}+// upgradeSpec6 将卡片和看板的预设尺寸转换为可连续调节的实际宽度和宽高比。func upgradeSpec6(av *AttributeView) {if 6 <= av.Spec {diff --git a/kernel/av/av_fix_test.go b/kernel/av/av_fix_test.goindex 60b1a44e6e..653a39270a 100644--- a/kernel/av/av_fix_test.go+++ b/kernel/av/av_fix_test.go@@ -56,13 +56,14 @@ func TestUpgradeSpec6CardConfiguration(t *testing.T) {}}-func TestLegacyCurrentViewIsNotPersisted(t *testing.T) {+func TestUpgradeSpec7RemovesPersistedCurrentView(t *testing.T) {attrView := &AttributeView{}if err := json.Unmarshal([]byte(`{"spec":6,"viewID":"legacy-view","views":[]}`), attrView); nil != err {t.Fatal(err)}- if CurrentSpec != attrView.Spec {- t.Fatalf("expected spec %d, got %d", CurrentSpec, attrView.Spec)+ UpgradeSpec(attrView)+ if 7 != attrView.Spec {+ t.Fatalf("expected spec 7, got %d", attrView.Spec)}data, err := json.Marshal(attrView)if nil != err {diff --git a/kernel/av/av_search_test.go b/kernel/av/av_search_test.goindex a28e62bdd0..52e248d5da 100644--- a/kernel/av/av_search_test.go+++ b/kernel/av/av_search_test.go@@ -48,7 +48,7 @@ func TestParseAttributeViewSearchInfo(t *testing.T) {t.Fatalf("unexpected second view: %+v", info.Views[1])}- if _, err = parseAttributeViewSearchInfo([]byte(`{"spec": 7}`)); err != ErrSpecTooNew {+ if _, err = parseAttributeViewSearchInfo([]byte(`{"spec": 8}`)); err != ErrSpecTooNew {t.Fatalf("expected newer spec error, got %v", err)}}