Skip to content

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

:bug: Improve av https://github.com/siyuan-note/siyuan/issues/15472

Danielec7ca366ba72
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 7499d1b33f..249457cb45 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -415,11 +415,33 @@ func SetAttributeViewGroup(avID, blockID string, group *av.ViewGroup) (err error
return err
}
+ oldHideEmpty := false
+ if nil != view.Group {
+ oldHideEmpty = view.Group.HideEmpty
+ }
+
groupStates := getAttrViewGroupStates(view)
view.Group = group
regenAttrViewViewGroups(attrView, "force")
setAttrViewGroupStates(view, groupStates)
+ if view.Group.HideEmpty != oldHideEmpty {
+ if !oldHideEmpty && view.Group.HideEmpty { // 启用隐藏空分组
+ for _, g := range view.Groups {
+ if g.GroupHidden == 0 && 1 > len(g.GroupItemIDs) {
+ g.GroupHidden = 1
+ }
+ }
+ }
+ if oldHideEmpty && !view.Group.HideEmpty { // 禁用隐藏空分组
+ for _, g := range view.Groups {
+ if g.GroupHidden == 1 && 1 > len(g.GroupItemIDs) {
+ g.GroupHidden = 0
+ }
+ }
+ }
+ }
+
err = av.SaveAttributeView(attrView)
ReloadAttrView(avID)
return