Bläddra i källkod

fix: lint warnings

Tienson Qin 1 år sedan
förälder
incheckning
27a29a3fbe

+ 1 - 2
src/main/frontend/components/page_menu.cljs

@@ -1,6 +1,5 @@
 (ns frontend.components.page-menu
-  (:require [clojure.string :as string]
-            [frontend.commands :as commands]
+  (:require [frontend.commands :as commands]
             [frontend.components.export :as export]
             [frontend.context.i18n :refer [t]]
             [frontend.db :as db]

+ 0 - 1
src/main/frontend/handler/common/page.cljs

@@ -4,7 +4,6 @@
   is still some file-specific tech debt to remove from create!"
   (:require [clojure.string :as string]
             [frontend.db :as db]
-            [frontend.db.model :as model]
             [frontend.handler.config :as config-handler]
             [frontend.handler.route :as route-handler]
             [frontend.state :as state]

+ 0 - 54
src/main/frontend/worker/handler/page/rename.cljs

@@ -1,7 +1,6 @@
 (ns frontend.worker.handler.page.rename
   "Page rename"
   (:require [datascript.core :as d]
-            [medley.core :as medley]
             [clojure.string :as string]
             [frontend.worker.file.util :as wfu]
             [frontend.worker.file.page-rename :as page-rename]
@@ -9,59 +8,6 @@
             [logseq.db :as ldb]
             [logseq.common.util :as common-util]))
 
-(defn- replace-page-ref
-  "Replace from-page refs with to-page"
-  [from-page to-page]
-  (let [refs (:block/_refs from-page)
-        from-uuid (:block/uuid from-page)
-        to-uuid (:block/uuid to-page)
-        replace-ref (fn [content] (string/replace content (str from-uuid) (str to-uuid)))]
-    (when (seq refs)
-      (let [tx-data (mapcat
-                     (fn [{:block/keys [raw-content properties] :as ref}]
-                         ;; block content or properties
-                       (let [content' (replace-ref raw-content)
-                             content-tx (when (not= raw-content content')
-                                          {:db/id (:db/id ref)
-                                           :block/content content'})
-                             properties' (-> (medley/map-vals (fn [v]
-                                                                (cond
-                                                                  (and (coll? v) (uuid? (first v)))
-                                                                  (mapv (fn [id] (if (= id from-uuid) to-uuid id)) v)
-
-                                                                  (and (uuid? v) (= v from-uuid))
-                                                                  to-uuid
-
-                                                                  (and (coll? v) (string? (first v)))
-                                                                  (mapv replace-ref v)
-
-                                                                  (string? v)
-                                                                  (replace-ref v)
-
-                                                                  :else
-                                                                  v)) properties)
-                                             (common-util/remove-nils-non-nested))
-                             tx (merge
-                                 content-tx
-                                 (when (not= (seq properties) (seq properties'))
-                                   {:db/id (:db/id ref)
-                                    ;; FIXME: properties
-                                    :block/properties properties'}))]
-                         (concat
-                          [[:db/add (:db/id ref) :block/refs (:db/id to-page)]
-                           [:db/retract (:db/id ref) :block/refs (:db/id from-page)]]
-                          (when tx [tx]))))
-                     refs)]
-        tx-data))))
-
-(defn- rename-update-block-refs!
-  [refs from-id to-id]
-  (->> refs
-       (remove #{{:db/id from-id}})
-       (cons {:db/id to-id})
-       (distinct)
-       (vec)))
-
 (declare rename-page-aux)
 
 ;; FIXME: bring it back, decouple this from page renaming though

+ 1 - 1
src/test/frontend/worker/handler/page/rename_test.cljs

@@ -11,7 +11,7 @@
 
 (def init-data (test-helper/initial-test-page-and-blocks))
 
-(def fbid (:block/uuid (second init-data)))
+;; (def fbid (:block/uuid (second init-data)))
 
 (defn start-and-destroy-db
   [f]

+ 2 - 1
src/test/frontend/worker/rtc/local_tx_to_remote_test.cljs

@@ -11,7 +11,8 @@
             [frontend.worker.state :as worker-state]
             [logseq.common.config :as common-config]
             [logseq.outliner.core :as outliner-core]
-            [logseq.outliner.transaction :as outliner-tx]))
+            [logseq.outliner.transaction :as outliner-tx]
+            [logseq.db :as ldb]))
 
 
 (use-fixtures :each

+ 0 - 1
src/test/frontend/worker/rtc/rtc_effects_test.cljs

@@ -5,7 +5,6 @@
   (:require ["/frontend/idbkv" :as idb-keyval]
             [cljs.core.async :as async :refer [<! >! go timeout]]
             [clojure.test :as t :refer [deftest is use-fixtures]]
-            [datascript.core :as d]
             [frontend.db.conn :as conn]
             [frontend.handler.page :as page-handler]
             [frontend.state :as state]