fix: Problem keeping separate graphs separated

close #3309
This commit is contained in:
Tienson Qin
2021-12-09 22:40:50 +08:00
parent d29185a781
commit d3f0bd5fa4
2 changed files with 9 additions and 7 deletions

View File

@@ -699,10 +699,12 @@
first)))))
(defn get-page-file
[page-name]
(some-> (or (db-utils/entity [:block/name page-name])
(db-utils/entity [:block/original-name page-name]))
:block/file))
([page-name]
(get-page-file (state/get-current-repo) page-name))
([repo page-name]
(some-> (or (db-utils/entity repo [:block/name page-name])
(db-utils/entity repo [:block/original-name page-name]))
:block/file)))
(defn get-block-file-path
[block]

View File

@@ -125,9 +125,9 @@
data)))
(defn- page-exists-in-another-file
[page file]
[repo-url page file]
(when-let [page-name (:block/name page)]
(let [current-file (:file/path (db/get-page-file page-name))]
(let [current-file (:file/path (db/get-page-file repo-url page-name))]
(when (not= file current-file)
current-file))))
@@ -164,7 +164,7 @@
(db/delete-file-blocks! repo-url file)
(when first-page (db/delete-page-blocks repo-url (:block/name first-page))))
(distinct))
_ (when-let [current-file (page-exists-in-another-file first-page file)]
_ (when-let [current-file (page-exists-in-another-file repo-url first-page file)]
(when (not= file current-file)
(let [error (str "Page already exists with another file: " current-file ", current file: " file)]
(state/pub-event! [:notification/show