🎨 Supports multiple views for the database https://github.com/siyuan-note/siyuan/issues/9751

This commit is contained in:
Daniel 2023-12-01 10:33:38 +08:00
parent f5fdab844e
commit 4d5071c31d
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -643,6 +643,10 @@ func (tx *Transaction) doRemoveAttrViewView(operation *Operation) (ret *TxErr) {
return &TxErr{code: TxErrCodeBlockNotFound, id: avID}
}
if 1 >= len(attrView.Views) {
return
}
viewID := operation.ID
for i, view := range attrView.Views {
if viewID == view.ID {
@ -651,6 +655,7 @@ func (tx *Transaction) doRemoveAttrViewView(operation *Operation) (ret *TxErr) {
}
}
attrView.ViewID = attrView.Views[0].ID
if err = av.SaveAttributeView(attrView); nil != err {
logging.LogErrorf("save attribute view [%s] failed: %s", avID, err)
return &TxErr{code: TxErrCodeWriteTree, msg: err.Error(), id: avID}