mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Improve data snapshot comparison https://github.com/siyuan-note/siyuan/issues/8081
This commit is contained in:
parent
0dcca1ec23
commit
a2fae4dce1
2 changed files with 7 additions and 4 deletions
|
|
@ -36,7 +36,7 @@ func openRepoSnapshotDoc(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
id := arg["id"].(string)
|
id := arg["id"].(string)
|
||||||
id, rootID, content, isLargeDoc, err := model.OpenRepoSnapshotDoc(id)
|
id, rootID, content, isLargeDoc, updated, err := model.OpenRepoSnapshotDoc(id)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
ret.Code = -1
|
ret.Code = -1
|
||||||
ret.Msg = err.Error()
|
ret.Msg = err.Error()
|
||||||
|
|
@ -48,6 +48,7 @@ func openRepoSnapshotDoc(c *gin.Context) {
|
||||||
"rootID": rootID,
|
"rootID": rootID,
|
||||||
"content": content,
|
"content": content,
|
||||||
"isLargeDoc": isLargeDoc,
|
"isLargeDoc": isLargeDoc,
|
||||||
|
"updated": updated,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ type TypeCount struct {
|
||||||
Count int `json:"count"`
|
Count int `json:"count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func OpenRepoSnapshotDoc(fileID string) (id, rootID, content string, isLargeDoc bool, err error) {
|
func OpenRepoSnapshotDoc(fileID string) (id, rootID, content string, isLargeDoc bool, updated int64, err error) {
|
||||||
if 1 > len(Conf.Repo.Key) {
|
if 1 > len(Conf.Repo.Key) {
|
||||||
err = errors.New(Conf.Language(26))
|
err = errors.New(Conf.Language(26))
|
||||||
return
|
return
|
||||||
|
|
@ -80,7 +80,7 @@ func OpenRepoSnapshotDoc(fileID string) (id, rootID, content string, isLargeDoc
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
luteEngine := NewLute()
|
luteEngine := NewLute()
|
||||||
isLargeDoc, snapshotTree, err := parseTreeInSnapshot(fileID, repo, luteEngine)
|
isLargeDoc, snapshotTree, updated, err := parseTreeInSnapshot(fileID, repo, luteEngine)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logging.LogErrorf("parse tree from snapshot file [%s] failed", fileID)
|
logging.LogErrorf("parse tree from snapshot file [%s] failed", fileID)
|
||||||
return
|
return
|
||||||
|
|
@ -270,7 +270,7 @@ func parseTitleInSnapshot(fileID string, repo *dejavu.Repo, luteEngine *lute.Lut
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseTreeInSnapshot(fileID string, repo *dejavu.Repo, luteEngine *lute.Lute) (isLargeDoc bool, tree *parse.Tree, err error) {
|
func parseTreeInSnapshot(fileID string, repo *dejavu.Repo, luteEngine *lute.Lute) (isLargeDoc bool, tree *parse.Tree, updated int64, err error) {
|
||||||
file, err := repo.GetFile(fileID)
|
file, err := repo.GetFile(fileID)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return
|
return
|
||||||
|
|
@ -286,6 +286,8 @@ func parseTreeInSnapshot(fileID string, repo *dejavu.Repo, luteEngine *lute.Lute
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updated = file.Updated
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue