Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Improve ChangeAttrViewLayout (#15157)

Jeffrey Chenbf0018e0c4d5
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index a1d17b8dc9..b34c5a2921 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -150,18 +150,20 @@ func ChangeAttrViewLayout(blockID, avID string, layout av.LayoutType) (err error
view.LayoutType = newLayout
err = av.SaveAttributeView(attrView)
- node, tree, err := getNodeByBlockID(nil, blockID)
- if err != nil {
- return
- }
+ blockIDs := treenode.GetMirrorAttrViewBlockIDs(avID)
+ for _, blockID := range blockIDs {
+ node, tree, err := getNodeByBlockID(nil, blockID)
+ if err != nil {
+ continue
+ }
- node.AttributeViewType = string(view.LayoutType)
- attrs := parse.IAL2Map(node.KramdownIAL)
- attrs[av.NodeAttrView] = view.ID
- err = setNodeAttrs(node, tree, attrs)
- if err != nil {
- logging.LogWarnf("set node [%s] attrs failed: %s", blockID, err)
- return
+ node.AttributeViewType = string(view.LayoutType)
+ attrs := parse.IAL2Map(node.KramdownIAL)
+ attrs[av.NodeAttrView] = view.ID
+ err = setNodeAttrs(node, tree, attrs)
+ if err != nil {
+ logging.LogWarnf("set node [%s] attrs failed: %s", blockID, err)
+ }
}
ReloadAttrView(avID)