From db414990aa98c5ac393cbac499f66a59946d2f89 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sat, 5 Nov 2022 10:23:23 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=96=87=E6=A1=A3=E6=A0=91=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20`Ctrl+Click`=20=E5=92=8C=20`Shift+=E2=86=91/?= =?UTF-8?q?=E2=86=93`=20=E8=BF=9B=E8=A1=8C=E5=A4=9A=E9=80=89=20https://git?= =?UTF-8?q?hub.com/siyuan-note/siyuan/issues/1359?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/file.go | 7 +------ kernel/util/path.go | 7 ------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/kernel/model/file.go b/kernel/model/file.go index 6b87d9c0b..33773fb2f 100644 --- a/kernel/model/file.go +++ b/kernel/model/file.go @@ -1012,12 +1012,7 @@ func MoveDocs(fromPaths []string, toBoxID, toPath string) (err error) { return } - if "/" == toPath { - // 移动到根目录下时不需要根据目标路径去重,所以这里传入一个不可能存在的随机笔记本名称 - fromPaths = util.FilterMoveDocFromPaths(fromPaths, ast.NewNodeID()) - } else { - fromPaths = util.FilterMoveDocFromPaths(fromPaths, toPath) - } + fromPaths = util.FilterSelfChildDocs(fromPaths) pathsBoxes := getBoxesByPaths(fromPaths) // 检查路径深度是否超过限制 diff --git a/kernel/util/path.go b/kernel/util/path.go index 2c82e3cea..722018f75 100644 --- a/kernel/util/path.go +++ b/kernel/util/path.go @@ -175,13 +175,6 @@ func NormalizeEndpoint(endpoint string) string { return endpoint } -func FilterMoveDocFromPaths(fromPaths []string, toPath string) (retFromPaths []string) { - fromPaths = append(fromPaths, toPath) - retFromPaths = FilterSelfChildDocs(fromPaths) - retFromPaths = gulu.Str.ExcludeElem(retFromPaths, []string{toPath}) - return -} - func FilterSelfChildDocs(paths []string) (ret []string) { sort.Slice(paths, func(i, j int) bool { return strings.Count(paths[i], "/") < strings.Count(paths[j], "/") })