mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
🎨 Automatically refresh database views after deleting/rolling back documents https://github.com/siyuan-note/siyuan/issues/12081
This commit is contained in:
parent
4ccf648e57
commit
8fee81c8c1
3 changed files with 32 additions and 15 deletions
|
|
@ -248,6 +248,7 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
var avIDs []string
|
||||
tree, _ := loadTree(srcPath, util.NewLute())
|
||||
if nil != tree {
|
||||
historyDir := strings.TrimPrefix(historyPath, util.HistoryDir+string(os.PathSeparator))
|
||||
|
|
@ -266,8 +267,11 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
|
|||
logging.LogErrorf("copy av [%s] failed: %s", srcAvPath, copyErr)
|
||||
}
|
||||
}
|
||||
|
||||
avIDs = append(avIDs, avNode.AttributeViewID)
|
||||
}
|
||||
}
|
||||
avIDs = gulu.Str.RemoveDuplicatedElem(avIDs)
|
||||
|
||||
tree.Box = boxID
|
||||
tree.Path = filepath.ToSlash(strings.TrimPrefix(destPath, util.DataDir+string(os.PathSeparator)+boxID))
|
||||
|
|
@ -305,6 +309,11 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
|
|||
"refText": refText,
|
||||
}
|
||||
util.PushEvent(evt)
|
||||
|
||||
// 刷新属性视图
|
||||
for _, avID := range avIDs {
|
||||
util.PushReloadAttrView(avID)
|
||||
}
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue