don't open page if graph doesn't exist

pull/5364/head
llcc 2022-05-16 19:13:39 +08:00 committed by Tienson Qin
parent 02dd4725fa
commit fd75cc57f0
2 changed files with 19 additions and 16 deletions

View File

@ -103,7 +103,7 @@
:options {:on-click #(js/window.apis.openPath file-path)}}])
(when (or (util/electron?)
(mobile-util/native-ios?))
(mobile-util/is-native-platform?))
{:title (t :page/copy-page-url)
:options {:on-click #(util/copy-to-clipboard!
(url-util/get-logseq-graph-page-url nil repo page-original-name))}})

View File

@ -50,23 +50,26 @@
(reset! *link-to-another-graph true))
(notification/show! (str "Open graph failed. Graph `" graph-name "` doesn't exist.") :error false))))
(js/setTimeout
(fn []
(cond
page-name
(let [db-page-name (db-model/get-redirect-page-name page-name)]
(editor-handler/insert-first-page-block-if-not-exists! db-page-name))
(when (or (= graph-name current-graph-name)
@*link-to-another-graph)
(js/setTimeout
(fn []
(cond
page-name
(let [db-page-name (db-model/get-redirect-page-name page-name)]
(editor-handler/insert-first-page-block-if-not-exists! db-page-name))
block-uuid
(if (db-model/get-block-by-uuid block-uuid)
(route-handler/redirect-to-page! block-uuid)
(notification/show! (str "Open link failed. Block-id `" block-uuid "` doesn't exist in the graph.") :error false))
block-uuid
(if (db-model/get-block-by-uuid block-uuid)
(route-handler/redirect-to-page! block-uuid)
(notification/show! (str "Open link failed. Block-id `" block-uuid "` doesn't exist in the graph.") :error false))
:else
nil))
(if @*link-to-another-graph
1000
0))))
:else
nil)
(reset! *link-to-another-graph false))
(if @*link-to-another-graph
1000
0)))))
(= hostname "shared")
(let [result (into {} (map (fn [key]