浏览代码

don't open page if graph doesn't exist

llcc 3 年之前
父节点
当前提交
fd75cc57f0
共有 2 个文件被更改,包括 19 次插入16 次删除
  1. 1 1
      src/main/frontend/components/page_menu.cljs
  2. 18 15
      src/main/frontend/mobile/deeplink.cljs

+ 1 - 1
src/main/frontend/components/page_menu.cljs

@@ -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))}})

+ 18 - 15
src/main/frontend/mobile/deeplink.cljs

@@ -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]