🐛 Database kanban view grouping modification issues https://github.com/siyuan-note/siyuan/issues/16511

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2025-12-04 17:50:06 +08:00
parent 3eb3836d91
commit 3a1376d49e
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -241,6 +241,8 @@ func getAttrViewAddingBlockDefaultValues(attrView *av.AttributeView, view, group
if !av.MSelectExistOption(newValue.MSelect, groupView.GetGroupValue()) {
if 1 > len(newValue.MSelect) || av.KeyTypeMSelect == groupKey.Type {
newValue.MSelect = append(newValue.MSelect, &av.ValueSelect{Content: opt.Name, Color: opt.Color})
} else {
newValue.MSelect = []*av.ValueSelect{{Content: opt.Name, Color: opt.Color}}
}
} else {
var vals []*av.ValueSelect
@ -3987,11 +3989,18 @@ func sortAttributeViewRow(operation *Operation) (err error) {
if targetGroupView := view.GetGroupByID(operation.TargetGroupID); nil != targetGroupView && !gulu.Str.Contains(itemID, targetGroupView.GroupItemIDs) {
fillDefaultValue(attrView, view, targetGroupView, operation.PreviousID, itemID, false)
// 移除旧分组的值
if val := attrView.GetValue(groupKey.ID, itemID); nil != val {
if av.MSelectExistOption(val.MSelect, groupView.GetGroupValue()) {
// 移除旧分组的值
val.MSelect = av.MSelectRemoveOption(val.MSelect, groupView.GetGroupValue())
}
now := time.Now().UnixMilli()
val.SetUpdatedAt(now)
if blockVal := attrView.GetBlockValue(itemID); nil != blockVal {
blockVal.Block.Updated = now
blockVal.SetUpdatedAt(now)
}
}
for i, r := range targetGroupView.GroupItemIDs {