@@ -259,7 +259,6 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
259259 }
260260 historyDir = filepath .Join (util .HistoryDir , historyDir )
261261
262- // 恢复包含的的属性视图 https://github.com/siyuan-note/siyuan/issues/9567
263262 avNodes := tree .Root .ChildrenByType (ast .NodeAttributeView )
264263 for _ , avNode := range avNodes {
265264 srcAvPath := filepath .Join (historyDir , "storage" , "av" , avNode .AttributeViewID + ".json" )
@@ -652,15 +651,7 @@ func (box *Box) generateDocHistory0() {
652651 if nil != loadErr {
653652 logging .LogErrorf ("load tree [%s] failed: %s" , file , loadErr )
654653 } else {
655- // 关联的属性视图也要复制到历史中 https://github.com/siyuan-note/siyuan/issues/9567
656- avNodes := tree .Root .ChildrenByType (ast .NodeAttributeView )
657- for _ , avNode := range avNodes {
658- srcAvPath := filepath .Join (util .DataDir , "storage" , "av" , avNode .AttributeViewID + ".json" )
659- destAvPath := filepath .Join (historyDir , "storage" , "av" , avNode .AttributeViewID + ".json" )
660- if copyErr := filelock .Copy (srcAvPath , destAvPath ); nil != copyErr {
661- logging .LogErrorf ("copy av [%s] failed: %s" , srcAvPath , copyErr )
662- }
663- }
654+ generateAvHistory (tree , historyDir )
664655 }
665656 }
666657 }
@@ -789,9 +780,22 @@ func generateOpTypeHistory(tree *parse.Tree, opType string) {
789780 return
790781 }
791782
783+ generateAvHistory (tree , historyDir )
784+
792785 indexHistoryDir (filepath .Base (historyDir ), util .NewLute ())
793786}
794787
788+ func generateAvHistory (tree * parse.Tree , historyDir string ) {
789+ avNodes := tree .Root .ChildrenByType (ast .NodeAttributeView )
790+ for _ , avNode := range avNodes {
791+ srcAvPath := filepath .Join (util .DataDir , "storage" , "av" , avNode .AttributeViewID + ".json" )
792+ destAvPath := filepath .Join (historyDir , "storage" , "av" , avNode .AttributeViewID + ".json" )
793+ if copyErr := filelock .Copy (srcAvPath , destAvPath ); nil != copyErr {
794+ logging .LogErrorf ("copy av [%s] failed: %s" , srcAvPath , copyErr )
795+ }
796+ }
797+ }
798+
795799func GetHistoryDir (suffix string ) (ret string , err error ) {
796800 return getHistoryDir (suffix , time .Now ())
797801}
0 commit comments