Few fixes re history

This commit is contained in:
mcrakhman 2023-01-18 09:16:38 +01:00 committed by Mikhail Iudin
parent 4f27e8e48d
commit bb665828bc
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0
3 changed files with 14 additions and 2 deletions

View File

@ -36,5 +36,17 @@ func (h *historyTree) rebuildFromStorage(beforeId string, include bool) (err err
}
ot.tree, err = ot.treeBuilder.build(heads, nil, nil)
if err != nil {
return
}
ot.aclList.RLock()
defer ot.aclList.RUnlock()
state := ot.aclList.AclState()
if len(ot.keys) != len(state.UserReadKeys()) {
for key, value := range state.UserReadKeys() {
ot.keys[key] = value
}
}
return
}

View File

@ -177,7 +177,7 @@ func buildHistoryTree(deps objectTreeDeps, params HistoryTreeParams) (ht History
newSnapshotsBuf: make([]*Change, 0, 10),
}
hTree := historyTree{objectTree: objTree}
hTree := &historyTree{objectTree: objTree}
err = hTree.rebuildFromStorage(params.BeforeId, params.IncludeBeforeId)
if err != nil {
return nil, err

View File

@ -335,7 +335,7 @@ func (s *space) BuildHistoryTree(ctx context.Context, id string, opts HistoryTre
IncludeBeforeId: opts.Include,
}
params.TreeStorage, err = s.storage.TreeStorage(id)
if err == nil {
if err != nil {
return
}
return objecttree.BuildHistoryTree(params)