|
@@ -10,7 +10,8 @@
|
|
|
[logseq.graph-parser.util :as gp-util]
|
|
|
[logseq.graph-parser.config :as gp-config]
|
|
|
[frontend.fs.capacitor-fs :as capacitor-fs]
|
|
|
- [frontend.context.i18n :refer [t]]))
|
|
|
+ [frontend.context.i18n :refer [t]]
|
|
|
+ [clojure.string :as string]))
|
|
|
|
|
|
(defn- page-exists-in-another-file
|
|
|
"Conflict of files towards same page"
|
|
@@ -24,11 +25,20 @@
|
|
|
[repo-url file-page file-path]
|
|
|
(when-let [current-file (page-exists-in-another-file repo-url file-page file-path)]
|
|
|
(when (not= file-path current-file)
|
|
|
- (let [error (t :file/validate-existing-file-error current-file file-path)]
|
|
|
- (state/pub-event! [:notification/show
|
|
|
- {:content error
|
|
|
- :status :error
|
|
|
- :clear? false}])))))
|
|
|
+ (cond
|
|
|
+ (= (string/lower-case current-file)
|
|
|
+ (string/lower-case file-path))
|
|
|
+ ;; case renamed
|
|
|
+ (when-let [file (db/pull [:file/path current-file])]
|
|
|
+ (db/transact! repo-url [{:db/id (:db/id file)
|
|
|
+ :file/path file-path}]))
|
|
|
+
|
|
|
+ :else
|
|
|
+ (let [error (t :file/validate-existing-file-error current-file file-path)]
|
|
|
+ (state/pub-event! [:notification/show
|
|
|
+ {:content error
|
|
|
+ :status :error
|
|
|
+ :clear? false}]))))))
|
|
|
|
|
|
(defn- validate-and-get-blocks-to-delete
|
|
|
[repo-url db file-page file-path retain-uuid-blocks]
|