This commit is contained in:
Daniel 2025-07-25 22:36:02 +08:00
parent 3c0933beac
commit f1f363d77b
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 39 additions and 0 deletions

View file

@ -206,6 +206,43 @@ func hideAttributeViewGroup(avID, blockID, groupID string, hidden int) (err erro
return nil
}
func (tx *Transaction) doFoldAttrViewGroup(operation *Operation) (ret *TxErr) {
if err := foldAttrViewGroup(operation.AvID, operation.BlockID, operation.ID, operation.Data.(bool)); nil != err {
return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}
}
return
}
func foldAttrViewGroup(avID, blockID, groupID string, folded bool) (err error) {
attrView, err := av.ParseAttributeView(avID)
if err != nil {
return err
}
view, err := getAttrViewViewByBlockID(attrView, blockID)
if err != nil {
return err
}
if nil == view.Group {
return
}
for _, group := range view.Groups {
if group.ID == groupID {
group.GroupFolded = folded
break
}
}
err = av.SaveAttributeView(attrView)
if err != nil {
logging.LogErrorf("save attribute view [%s] failed: %s", avID, err)
return err
}
return nil
}
func (tx *Transaction) doSetAttrViewGroup(operation *Operation) (ret *TxErr) {
data, err := gulu.JSON.MarshalJSON(operation.Data)
if nil != err {

View file

@ -301,6 +301,8 @@ func performTx(tx *Transaction) (ret *TxErr) {
ret = tx.doSetAttrViewGroup(op)
case "hideAttrViewGroup":
ret = tx.doHideAttrViewGroup(op)
case "foldAttrViewGroup":
ret = tx.doFoldAttrViewGroup(op)
case "syncAttrViewTableColWidth":
ret = tx.doSyncAttrViewTableColWidth(op)
case "removeAttrViewGroup":