fix: try to fix duplicated journals

Relates to https://github.com/logseq/logseq/issues/595
pull/645/head
Tienson Qin 2020-11-07 19:25:53 +08:00
parent 553b1079b1
commit ccc88a37e2
1 changed files with 5 additions and 10 deletions

View File

@ -154,6 +154,7 @@
content (cond
content
content
template
(str default-content template)
@ -169,16 +170,10 @@
(p/let [_ (-> (fs/mkdir (str repo-dir "/" config/default-journals-directory))
(p/catch (fn [_e])))
file-exists? (fs/create-if-not-exists repo-dir file-path content)]
;; TODO: why file exists but page not created
(p/let [resolved-content (if file-exists?
(file-handler/load-file repo-url path)
(p/resolved content))]
(let [content (if (string/blank? (string/trim resolved-content))
content
resolved-content)]
(db/reset-file! repo-url path content)
(ui-handler/re-render-root!)
(git-handler/git-add repo-url path))))))))
(when-not file-exists?
(db/reset-file! repo-url path content)
(ui-handler/re-render-root!)
(git-handler/git-add repo-url path)))))))
(defn create-default-files!
[repo-url]