Tienson Qin 5 лет назад
Родитель
Сommit
fbf461699d

+ 2 - 5
src/main/frontend/components/page.cljs

@@ -480,7 +480,7 @@
               [:th (t :page/name)]
               [:th (t :file/last-modified-at)]]]
             [:tbody
-             (for [[page modified-at] pages]
+             (for [page pages]
                (let [encoded-page (util/encode-str page)]
                  [:tr {:key encoded-page}
                   [:td [:a {:on-click (fn [e]
@@ -495,10 +495,7 @@
                             :href (rfe/href :page {:name encoded-page})}
                         page]]
                   [:td [:span.text-gray-500.text-sm
-                        (if (zero? modified-at)
-                          (t :file/no-data)
-                          (date/get-date-time-string
-                           (t/to-default-time-zone (tc/to-date-time modified-at))))]]]))]]))])))
+                        (t :file/no-data)]]]))]]))])))
 
 (rum/defcs new < rum/reactive
   (rum/local "" ::title)

+ 5 - 1
src/main/frontend/config.cljs

@@ -323,7 +323,11 @@
 (defn get-file-path
   [repo-url relative-path]
   (if (and (util/electron?) (local-db? repo-url))
-    (str (get-repo-dir repo-url) "/" relative-path)
+    (let [dir (get-repo-dir repo-url)]
+      (if (string/starts-with? relative-path dir)
+        relative-path
+        (str dir "/"
+             (string/replace relative-path #"^/" ""))))
     relative-path))
 
 (defn get-config-path

+ 2 - 8
src/main/frontend/fs.cljs

@@ -65,7 +65,7 @@
   (->
    (do
      (protocol/write-file! (get-fs dir) repo dir path content opts)
-     (db/set-file-last-modified-at! repo path (js/Date.)))
+     (db/set-file-last-modified-at! repo (config/get-file-path repo path) (js/Date.)))
    (p/catch (fn [error]
               (log/error :file/write-failed? {:dir dir
                                               :path path
@@ -86,13 +86,7 @@
 
 (defn stat
   [dir path]
-  (let [append-path (if path
-                      (str "/"
-                           (if (= \/ (first path))
-                             (subs path 1)
-                             path))
-                      "")]
-    (protocol/stat (get-fs dir) dir path)))
+  (protocol/stat (get-fs dir) dir path))
 
 (defn open-dir
   [ok-handler]