🎨 数据快照对比加入时间标识 https://github.com/siyuan-note/siyuan/issues/6899

This commit is contained in:
Liang Ding 2022-12-21 15:31:43 +08:00
parent c949441bfb
commit 0603ed3656
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -128,8 +128,8 @@ func OpenRepoSnapshotDoc(fileID string) (id, rootID, content string, isLargeDoc
}
type LeftRightDiff struct {
LeftIndex *entity.Index `json:"leftIndex"`
RightIndex *entity.Index `json:"rightIndex"`
LeftIndex *DiffIndex `json:"leftIndex"`
RightIndex *DiffIndex `json:"rightIndex"`
AddsLeft []*DiffFile `json:"addsLeft"`
UpdatesLeft []*DiffFile `json:"updatesLeft"`
UpdatesRight []*DiffFile `json:"updatesRight"`
@ -141,6 +141,11 @@ type DiffFile struct {
Title string `json:"title"`
}
type DiffIndex struct {
ID string `json:"id"`
Created int64 `json:"created"`
}
func DiffRepoSnapshots(left, right string) (ret *LeftRightDiff, err error) {
if 1 > len(Conf.Repo.Key) {
err = errors.New(Conf.Language(26))
@ -157,12 +162,15 @@ func DiffRepoSnapshots(left, right string) (ret *LeftRightDiff, err error) {
return
}
diff.LeftIndex.Files = nil
diff.RightIndex.Files = nil
ret = &LeftRightDiff{
LeftIndex: diff.LeftIndex,
RightIndex: diff.RightIndex,
LeftIndex: &DiffIndex{
ID: diff.LeftIndex.ID,
Created: diff.LeftIndex.Created,
},
RightIndex: &DiffIndex{
ID: diff.RightIndex.ID,
Created: diff.RightIndex.Created,
},
}
luteEngine := NewLute()
for _, addLeft := range diff.AddsLeft {