mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
0cf13cca8f
2 changed files with 7 additions and 1 deletions
|
|
@ -48,6 +48,7 @@ func renderSnapshotAttributeView(c *gin.Context) {
|
|||
for _, v := range attrView.Views {
|
||||
view := map[string]interface{}{
|
||||
"id": v.ID,
|
||||
"icon": v.Icon,
|
||||
"name": v.Name,
|
||||
"type": v.LayoutType,
|
||||
}
|
||||
|
|
@ -88,6 +89,7 @@ func renderHistoryAttributeView(c *gin.Context) {
|
|||
for _, v := range attrView.Views {
|
||||
view := map[string]interface{}{
|
||||
"id": v.ID,
|
||||
"icon": v.Icon,
|
||||
"name": v.Name,
|
||||
"type": v.LayoutType,
|
||||
}
|
||||
|
|
@ -132,6 +134,7 @@ func renderAttributeView(c *gin.Context) {
|
|||
for _, v := range attrView.Views {
|
||||
view := map[string]interface{}{
|
||||
"id": v.ID,
|
||||
"icon": v.Icon,
|
||||
"name": v.Name,
|
||||
"type": v.LayoutType,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -644,18 +644,21 @@ func (tx *Transaction) doRemoveAttrViewView(operation *Operation) (ret *TxErr) {
|
|||
}
|
||||
|
||||
if 1 >= len(attrView.Views) {
|
||||
logging.LogWarnf("can't remove last view [%s] of attribute view [%s]", operation.ID, avID)
|
||||
return
|
||||
}
|
||||
|
||||
viewID := operation.ID
|
||||
var index int
|
||||
for i, view := range attrView.Views {
|
||||
if viewID == view.ID {
|
||||
attrView.Views = append(attrView.Views[:i], attrView.Views[i+1:]...)
|
||||
index = i - 1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
attrView.ViewID = attrView.Views[0].ID
|
||||
attrView.ViewID = attrView.Views[index].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}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue