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

pull/6598/head
Tienson Qin 2022-09-03 20:49:11 +08:00 committed by Andelf
parent 666981ef0b
commit e9ee940873
3 changed files with 8 additions and 11 deletions

View File

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

View File

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

View File

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