Browse Source

fix: lint warnings

Tienson Qin 3 years ago
parent
commit
2e5ac247a2

+ 1 - 2
src/main/frontend/handler/common.cljs

@@ -17,7 +17,6 @@
             ["ignore" :as Ignore]
             [lambdaisland.glogi :as log]
             [promesa.core :as p]
-            [frontend.handler.notification :as notification]
             [borkdude.rewrite-edn :as rewrite]))
 
 (defn get-ref
@@ -237,7 +236,7 @@
 
 (defn parse-config
   "Parse configuration from file `content` such as from config.edn."
-  [path content]
+  [content]
   (try
     (rewrite/parse-string content)
     (catch js/Error e

+ 5 - 3
src/main/frontend/handler/events.cljs

@@ -21,6 +21,7 @@
             [frontend.handler.search :as search-handler]
             [frontend.handler.ui :as ui-handler]
             [frontend.handler.repo :as repo-handler]
+            [frontend.handler.file :as file-handler]
             [frontend.handler.route :as route-handler]
             [frontend.modules.shortcut.core :as st]
             [frontend.modules.outliner.file :as outliner-file]
@@ -289,15 +290,16 @@
         (when (and pending? (seq (state/all-available-coming-updates)))
           (plugin/open-waiting-updates-modal!))))))
 
-(defmethod handle :backup/broken-config [[_ repo path content]]
+(defmethod handle :backup/broken-config [[_ repo content]]
   (when (and repo content)
     (let [path (config/get-config-path)
           broken-path (str path "-broken")]
-      (p/let [_ (fs/write-file! repo (config/get-repo-dir repo) broken-path content {})]
+      (p/let [_ (fs/write-file! repo (config/get-repo-dir repo) broken-path content {})
+              _ (file-handler/alter-file repo path config/config-default-content {:skip-compare? true})]
         (notification/show!
          [:p.content
           "It seems that your config.edn is broken. We've restored it with the default content and saved the previous content to the file logseq/config.edn-broken."]
-         :error
+         :warning
          false)))))
 
 (defn run!

+ 1 - 1
src/main/frontend/handler/file.cljs

@@ -346,7 +346,7 @@
   (when-let [repo (state/get-current-repo)]
     (when-let [content (db/get-file path)]
       (common-handler/read-config content)
-      (let [result (common-handler/parse-config path content)
+      (let [result (common-handler/parse-config content)
             ks (if (vector? k) k [k])
             new-result (rewrite/assoc-in result ks v)
             new-content (str new-result)]

+ 1 - 1
src/main/frontend/modules/shortcut/data_helper.cljs

@@ -140,7 +140,7 @@
   (let [repo (state/get-current-repo)
         path (cfg/get-config-path)]
     (when-let [content (db/get-file path)]
-      (let [result (common-handler/parse-config path content)
+      (let [result (common-handler/parse-config content)
             new-result (rewrite/update
                         result
                         :shortcuts