mirror of
https://github.com/logseq/logseq.git
synced 2026-05-24 12:44:22 +00:00
refactor(fs): avoid misleading variable names
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
[frontend.date :as date]
|
||||
[frontend.db :as db]
|
||||
[frontend.db.model :as db-model]
|
||||
[frontend.db.model :as model]
|
||||
[frontend.db.utils :as db-utils]
|
||||
[frontend.db.query-dsl :as query-dsl]
|
||||
[frontend.diff :as diff]
|
||||
@@ -15,14 +16,15 @@
|
||||
[frontend.format.mldoc :as mldoc]
|
||||
[frontend.fs :as fs]
|
||||
[frontend.fs.nfs :as nfs]
|
||||
[frontend.fs2.path :as fs2-path]
|
||||
[frontend.handler.assets :as assets-handler]
|
||||
[frontend.handler.block :as block-handler]
|
||||
[frontend.handler.common :as common-handler]
|
||||
[frontend.handler.export.text :as export-text]
|
||||
[frontend.handler.export.html :as export-html]
|
||||
[frontend.handler.export.text :as export-text]
|
||||
[frontend.handler.notification :as notification]
|
||||
[frontend.handler.repeated :as repeated]
|
||||
[frontend.handler.route :as route-handler]
|
||||
[frontend.handler.assets :as assets-handler]
|
||||
[frontend.mobile.util :as mobile-util]
|
||||
[frontend.modules.outliner.core :as outliner-core]
|
||||
[frontend.modules.outliner.transaction :as outliner-tx]
|
||||
@@ -54,8 +56,7 @@
|
||||
[logseq.graph-parser.util.block-ref :as block-ref]
|
||||
[logseq.graph-parser.util.page-ref :as page-ref]
|
||||
[promesa.core :as p]
|
||||
[rum.core :as rum]
|
||||
[frontend.fs2.path :as fs2-path]))
|
||||
[rum.core :as rum]))
|
||||
|
||||
;; FIXME: should support multiple images concurrently uploading
|
||||
|
||||
|
||||
@@ -106,19 +106,19 @@
|
||||
(def init-level 1)
|
||||
|
||||
(defn- transact-file-tx-if-not-exists!
|
||||
[page ok-handler]
|
||||
[page-block ok-handler]
|
||||
(when-let [repo (state/get-current-repo)]
|
||||
(when (:block/name page)
|
||||
(let [format (name (get page :block/format
|
||||
(when (:block/name page-block)
|
||||
(let [format (name (get page-block :block/format
|
||||
(state/get-preferred-format)))
|
||||
title (string/capitalize (:block/name page))
|
||||
whiteboard-page? (model/whiteboard-page? page)
|
||||
title (string/capitalize (:block/name page-block))
|
||||
whiteboard-page? (model/whiteboard-page? page-block)
|
||||
format (if whiteboard-page? "edn" format)
|
||||
journal-page? (date/valid-journal-title? title)
|
||||
journal-title (date/normalize-journal-title title)
|
||||
filename (if (and journal-page? (not (string/blank? journal-title)))
|
||||
(date/date->file-name journal-title)
|
||||
(-> (or (:block/original-name page) (:block/name page))
|
||||
(-> (or (:block/original-name page-block) (:block/name page-block))
|
||||
(fs-util/file-name-sanity)))
|
||||
sub-dir (cond
|
||||
journal-page? (config/get-journals-directory)
|
||||
@@ -128,7 +128,7 @@
|
||||
file-rpath (str sub-dir "/" filename "." ext) ;; FIXME: use path-join
|
||||
file {:file/path file-rpath}
|
||||
tx [{:file/path file-rpath}
|
||||
{:block/name (:block/name page)
|
||||
{:block/name (:block/name page-block)
|
||||
:block/file file}]]
|
||||
(db/transact! tx)
|
||||
(when ok-handler (ok-handler))))))
|
||||
|
||||
Reference in New Issue
Block a user