Improve recent documents handling (#16727)

* merge

* Update RecentDoc struct to make timestamp fields optional

* GetDoc is solely responsible for retrieving document content and does not handle business logic

* Remove RemoveRecentDoc function and its calls from multiple files to streamline document handling

* Ensure the API correctly returns an empty array, add deduplication logic, and remove redundant sorting steps when updating fields

* 🎨 Supports configuring the maximum number of `Recent documents` to be listed https://github.com/siyuan-note/siyuan/issues/16720

* merge

* 🎨 Supports configuring the maximum number of `Recent documents` to be listed https://github.com/siyuan-note/siyuan/issues/16720

* 🐛 Fix browsing time not sorted

* 🎨 Supports configuring the maximum number of `Recent documents` to be listed https://github.com/siyuan-note/siyuan/issues/16720

* merge

* remove async

* try catch
This commit is contained in:
Jeffrey Chen 2026-01-21 08:52:05 +08:00 committed by GitHub
parent fc5a79ff16
commit b0f71123a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 398 additions and 220 deletions

View file

@ -281,7 +281,6 @@ func Doc2Heading(srcID, targetID string, after bool) (srcTreeBox, srcTreePath st
logging.LogWarnf("remove tree [%s] failed: %s", srcTree.Path, removeErr)
}
box.removeSort([]string{srcTree.ID})
RemoveRecentDoc([]string{srcTree.ID})
evt := util.NewCmdResult("removeDoc", 0, util.PushModeBroadcast)
evt.Data = map[string]interface{}{
"ids": []string{srcTree.ID},