Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve av rollback https://github.com/siyuan-note/siyuan/issues/18052

Daniel73ce6c6476e2
diff --git a/kernel/av/mirror.go b/kernel/av/mirror.go
index 9b949faf30..95a0795a00 100644
--- a/kernel/av/mirror.go
+++ b/kernel/av/mirror.go
@@ -17,11 +17,6 @@ var (
AttributeViewBlocksLock = sync.Mutex{}
)
-func GetAvBlocks(avID string) []string {
- avBlocks := GetBlockRels()
- return avBlocks[avID]
-}
-
func GetBlockRels() (ret map[string][]string) {
AttributeViewBlocksLock.Lock()
defer AttributeViewBlocksLock.Unlock()
diff --git a/kernel/model/repository.go b/kernel/model/repository.go
index db0a4a996e..0bc832f89f 100644
--- a/kernel/model/repository.go
+++ b/kernel/model/repository.go
@@ -56,7 +56,6 @@ import (
"github.com/siyuan-note/filelock"
"github.com/siyuan-note/httpclient"
"github.com/siyuan-note/logging"
- "github.com/siyuan-note/siyuan/kernel/av"
"github.com/siyuan-note/siyuan/kernel/cache"
"github.com/siyuan-note/siyuan/kernel/conf"
"github.com/siyuan-note/siyuan/kernel/sql"
@@ -333,17 +332,7 @@ func RollbackRepoSnapshotFile(fileID string) (err error) {
if strings.HasPrefix(file.Path, "/storage/av/") && strings.HasSuffix(file.Path, ".json") {
avID := strings.TrimSuffix(filepath.Base(file.Path), ".json")
cache.RemoveAVData(avID)
- blockIDs := av.GetAvBlocks(avID)
- var reloadRootIDs []string
- for _, blockID := range blockIDs {
- if bt := treenode.GetBlockTree(blockID); nil != bt {
- reloadRootIDs = append(reloadRootIDs, blockID)
- }
- }
- reloadRootIDs = gulu.Str.RemoveDuplicatedElem(reloadRootIDs)
- for _, id := range reloadRootIDs {
- ReloadProtyle(id)
- }
+ ReloadAttrView(avID)
}
msg := fmt.Sprintf(Conf.Language(286), to)