fix: local page history not working

pull/7379/head^2
Tienson Qin 2022-11-18 16:11:09 +08:00
parent f47ef566cd
commit d4ba355c62
1 changed files with 19 additions and 11 deletions

View File

@ -15,7 +15,8 @@
[cljs-time.coerce :as tc]
[cljs-time.core :as t]
[frontend.storage :as storage]
[logseq.graph-parser.util :as gp-util]))
[logseq.graph-parser.util :as gp-util]
[lambdaisland.glogi :as log]))
(def *beta-unavailable? (volatile! false))
@ -142,18 +143,25 @@
(#(js->clj % :keywordize-keys true))
((juxt :dir :name))
(apply path/join base-path))
version-file-paths (<! (p->c (fs/readdir version-files-dir :path-only? true)))]
version-file-paths (->> (<! (p->c (fs/readdir version-files-dir :path-only? true)))
(remove #{version-files-dir}))]
(when-not (instance? ExceptionInfo version-file-paths)
(when (seq version-file-paths)
(mapv
(fn [path]
(let [create-time
(-> (path/parse path)
(js->clj :keywordize-keys true)
:name
(#(tf/parse (tf/formatter "yyyy-MM-dd'T'HH_mm_ss.SSSZZ") %)))]
{:create-time create-time :path path :relative-path (string/replace-first path base-path "")}))
version-file-paths)))))))
(->>
(mapv
(fn [path]
(try
(let [create-time
(-> (path/parse path)
(js->clj :keywordize-keys true)
:name
(#(tf/parse (tf/formatter "yyyy-MM-dd'T'HH_mm_ss.SSSZZ") %)))]
{:create-time create-time :path path :relative-path (string/replace-first path base-path "")})
(catch :default e
(log/error :page-history/parse-format-error e)
nil)))
version-file-paths)
(remove nil?))))))))
(defn fetch-page-file-versions [graph-uuid page]
[]