1
0
Эх сурвалжийг харах

fix: don't start sync if not logged in or it's not a remote graph

Tienson Qin 3 жил өмнө
parent
commit
e9ee940873

+ 1 - 2
src/main/frontend/commands.cljs

@@ -237,8 +237,7 @@
 
        ["Upload an asset" [[:editor/click-hidden-file-input :id]] "Upload file types like image, pdf, docx, etc.)"]
 
-       (state/deprecated-logged?)
-       ["Upload an image" [[:editor/click-hidden-file-input :id]]]
+       ;; ["Upload an image" [[:editor/click-hidden-file-input :id]]]
        )]
 
     (markdown-headings)

+ 7 - 4
src/main/frontend/fs/sync.cljs

@@ -2712,10 +2712,13 @@
     (go
       ;; stop previous sync
       (<! (<sync-stop))
-      (when-some [sm (sync-manager-singleton current-user-uuid graph-uuid
-                                             (config/get-repo-dir repo) repo
-                                             txid *sync-state)]
-        (when (and repo (not (config/demo-graph? repo)))
+      (when (and user-uuid graph-uuid txid
+                 (user/logged-in?)
+                 repo
+                 (not (config/demo-graph? repo)))
+        (when-some [sm (sync-manager-singleton current-user-uuid graph-uuid
+                                               (config/get-repo-dir repo) repo
+                                               txid *sync-state)]
           ;; 1. if remote graph has been deleted, clear graphs-txid.edn
           ;; 2. if graphs-txid.edn's content isn't [user-uuid graph-uuid txid], clear it
           (if (not= 3 (count @graphs-txid))

+ 0 - 5
src/main/frontend/state.cljs

@@ -1055,11 +1055,6 @@
   []
   (:me @state))
 
-(defn deprecated-logged?
-  "Whether the user has logged in."
-  []
-  false)
-
 (defn set-db-restoring!
   [value]
   (set-state! :db/restoring? value))