mirror of https://github.com/logseq/logseq
fix: don't create today's journal page if local directory is not loaded
parent
bf5e067fdd
commit
e8e319749c
|
@ -108,7 +108,7 @@
|
|||
|
||||
(def plus-circle
|
||||
[:svg.addButton
|
||||
{:viewbox "0 0 20 20"}
|
||||
{:viewBox "0 0 20 20"}
|
||||
[:circle.circle {:fill "#dce0e2", :r "9", :cy "10.5", :cx "10.5"}]
|
||||
[:line
|
||||
{:stroke-width "1"
|
||||
|
@ -139,24 +139,24 @@
|
|||
|
||||
(def folder (hero-icon "M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"))
|
||||
(def folder-sm (hero-icon "M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" {:height "16" :width "16"}))
|
||||
(def pages-sm [:svg {:viewbox "0 0 20 20", :fill "currentColor", :height "16", :width "16"}
|
||||
(def pages-sm [:svg {:viewBox "0 0 20 20", :fill "currentColor", :height "16", :width "16"}
|
||||
[:path {:d "M9 2a2 2 0 00-2 2v8a2 2 0 002 2h6a2 2 0 002-2V6.414A2 2 0 0016.414 5L14 2.586A2 2 0 0012.586 2H9z"}]
|
||||
[:path {:d "M3 8a2 2 0 012-2v10h8a2 2 0 01-2 2H5a2 2 0 01-2-2V8z"}]])
|
||||
(def repos-sm [:svg {:viewbox "0 0 20 20", :fill "currentColor", :height "16", :width "16"}
|
||||
(def repos-sm [:svg {:viewBox "0 0 20 20", :fill "currentColor", :height "16", :width "16"}
|
||||
[:path {:d "M3 12v3c0 1.657 3.134 3 7 3s7-1.343 7-3v-3c0 1.657-3.134 3-7 3s-7-1.343-7-3z"}]
|
||||
[:path {:d "M3 7v3c0 1.657 3.134 3 7 3s7-1.343 7-3V7c0 1.657-3.134 3-7 3S3 8.657 3 7z"}]
|
||||
[:path {:d "M17 5c0 1.657-3.134 3-7 3S3 6.657 3 5s3.134-3 7-3 7 1.343 7 3z"}]])
|
||||
(def settings-sm [:svg {:viewbox "0 0 20 20", :fill "currentColor", :height "20", :width "20"}
|
||||
(def settings-sm [:svg {:viewBox "0 0 20 20", :fill "currentColor", :height "20", :width "20"}
|
||||
[:path {:fill-rule "evenodd", :d "M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z", :clip-rule "evenodd"}]])
|
||||
(def calendar-sm [:svg {:viewbox "0 0 20 20", :fill "currentColor", :height "16", :width "16"}
|
||||
(def calendar-sm [:svg {:viewBox "0 0 20 20", :fill "currentColor", :height "16", :width "16"}
|
||||
[:path {:fill-rule "evenodd", :d "M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z", :clip-rule "evenodd"}]])
|
||||
(def import-sm [:svg {:viewbox "0 0 20 20", :fill "currentColor", :height "16", :width "16"}
|
||||
(def import-sm [:svg {:viewBox "0 0 20 20", :fill "currentColor", :height "16", :width "16"}
|
||||
[:path {:fill-rule "evenodd", :d "M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM6.293 6.707a1 1 0 010-1.414l3-3a1 1 0 011.414 0l3 3a1 1 0 01-1.414 1.414L11 5.414V13a1 1 0 11-2 0V5.414L7.707 6.707a1 1 0 01-1.414 0z", :clip-rule "evenodd"}]])
|
||||
(def logout-sm [:svg {:viewbox "0 0 20 20", :fill "currentColor", :height "18", :width "18"}
|
||||
(def logout-sm [:svg {:viewBox "0 0 20 20", :fill "currentColor", :height "18", :width "18"}
|
||||
[:path {:fill-rule "evenodd", :d "M3 3a1 1 0 00-1 1v12a1 1 0 102 0V4a1 1 0 00-1-1zm10.293 9.293a1 1 0 001.414 1.414l3-3a1 1 0 000-1.414l-3-3a1 1 0 10-1.414 1.414L14.586 9H7a1 1 0 100 2h7.586l-1.293 1.293z", :clip-rule "evenodd"}]])
|
||||
(def trash-sm [:svg {:viewbox "0 0 20 20", :fill "currentColor", :height "16", :width "16"}
|
||||
(def trash-sm [:svg {:viewBox "0 0 20 20", :fill "currentColor", :height "16", :width "16"}
|
||||
[:path {:fill-rule "evenodd", :d "M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z", :clip-rule "evenodd"}]])
|
||||
(def sort-asc-sm [:svg {:viewbox "0 0 16 16", :fill "currentColor"}
|
||||
(def sort-asc-sm [:svg {:viewBox "0 0 16 16", :fill "currentColor"}
|
||||
[:path {:d "M3 3a1 1 0 000 2h11a1 1 0 100-2H3zM3 7a1 1 0 000 2h5a1 1 0 000-2H3zM3 11a1 1 0 100 2h4a1 1 0 100-2H3zM13 16a1 1 0 102 0v-5.586l1.293 1.293a1 1 0 001.414-1.414l-3-3a1 1 0 00-1.414 0l-3 3a1 1 0 101.414 1.414L13 10.414V16z"}]])
|
||||
(defn vertical-dots
|
||||
[options]
|
||||
|
@ -411,7 +411,7 @@
|
|||
:stroke-linecap "round"}]])
|
||||
|
||||
(def page
|
||||
[:svg.h-5.w-4 {:viewbox "0 0 24 24", :fill "none", :xmlns "http://www.w3.org/2000/svg"}
|
||||
[:svg.h-5.w-4 {:viewBox "0 0 24 24", :fill "none", :xmlns "http://www.w3.org/2000/svg"}
|
||||
[:path {:d "M2 0.5H6.78272L13.5 7.69708V18C13.5 18.8284 12.8284 19.5 12 19.5H2C1.17157 19.5 0.5 18.8284 0.5 18V2C0.5 1.17157 1.17157 0.5 2 0.5Z", :fill "var(--ls-active-primary-color)"}]
|
||||
[:path {:d "M7 5.5V0L14 7.5H9C7.89543 7.5 7 6.60457 7 5.5Z", :fill "var(--ls-active-secondary-color)"}]])
|
||||
|
||||
|
|
|
@ -145,7 +145,9 @@
|
|||
(state/set-today! (date/today))
|
||||
(when-let [repo (state/get-current-repo)]
|
||||
(when (or (db/cloned? repo)
|
||||
(config/local-db? repo))
|
||||
(and (config/local-db? repo)
|
||||
;; config file exists
|
||||
(db/get-file (str config/app-name "/" config/config-file))))
|
||||
(let [today-page (string/lower-case (date/today))]
|
||||
(when (empty? (db/get-page-blocks-no-cache repo today-page))
|
||||
(create-today-journal-if-not-exists repo))))))
|
||||
|
@ -184,7 +186,8 @@
|
|||
(state/set-importing-to-db! false)))
|
||||
|
||||
(defn load-repo-to-db!
|
||||
[repo-url {:keys [first-clone? diffs nfs-files]}]
|
||||
[repo-url {:keys [first-clone? diffs nfs-files]
|
||||
:as opts}]
|
||||
(spec/validate :repos/url repo-url)
|
||||
(let [load-contents (fn [files option]
|
||||
(file-handler/load-files-contents!
|
||||
|
@ -193,10 +196,10 @@
|
|||
(fn [files-contents]
|
||||
(parse-files-and-load-to-db! repo-url files-contents option))))]
|
||||
(cond
|
||||
(and (not (seq diffs)) (seq nfs-files))
|
||||
(and (not (seq diffs)) nfs-files)
|
||||
(parse-files-and-load-to-db! repo-url nfs-files {:first-clone? true})
|
||||
|
||||
first-clone?
|
||||
(and first-clone? (not nfs-files))
|
||||
(->
|
||||
(p/let [files (file-handler/load-files repo-url)]
|
||||
(load-contents files {:first-clone? first-clone?}))
|
||||
|
|
Loading…
Reference in New Issue