mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-15 05:08:51 +01:00
Remove RemoveRecentDoc function and its calls from multiple files to streamline document handling
This commit is contained in:
parent
ddbcacfe81
commit
f6217c0b50
4 changed files with 1 additions and 27 deletions
|
|
@ -1596,7 +1596,6 @@ func removeDoc(box *Box, p string, luteEngine *lute.Lute) {
|
|||
logging.LogInfof("removed doc [%s%s]", box.ID, p)
|
||||
|
||||
box.removeSort(removeIDs)
|
||||
RemoveRecentDoc(removeIDs)
|
||||
if "/" != dir {
|
||||
others, err := os.ReadDir(filepath.Join(util.DataDir, box.ID, dir))
|
||||
if err == nil && 1 > len(others) {
|
||||
|
|
|
|||
|
|
@ -284,7 +284,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},
|
||||
|
|
|
|||
|
|
@ -113,8 +113,7 @@ func (box *Box) Unindex() {
|
|||
}
|
||||
|
||||
func unindex(boxID string) {
|
||||
ids := treenode.RemoveBlockTreesByBoxID(boxID)
|
||||
RemoveRecentDoc(ids)
|
||||
treenode.RemoveBlockTreesByBoxID(boxID)
|
||||
sql.DeleteBoxQueue(boxID)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,29 +126,6 @@ func trimRecentDocs(recentDocs []*RecentDoc) []*RecentDoc {
|
|||
return result
|
||||
}
|
||||
|
||||
func RemoveRecentDoc(ids []string) {
|
||||
recentDocLock.Lock()
|
||||
defer recentDocLock.Unlock()
|
||||
|
||||
recentDocs, err := getRecentDocs("")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
ids = gulu.Str.RemoveDuplicatedElem(ids)
|
||||
for i, doc := range recentDocs {
|
||||
if gulu.Str.Contains(doc.RootID, ids) {
|
||||
recentDocs = append(recentDocs[:i], recentDocs[i+1:]...)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
err = setRecentDocs(recentDocs)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateRecentDocOpenTime 更新文档打开时间(只在第一次从文档树加载到页签时调用)
|
||||
func UpdateRecentDocOpenTime(rootID string) (err error) {
|
||||
recentDocLock.Lock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue