Browse Source

fix: encrypted text in diff page

Tienson Qin 4 years ago
parent
commit
3b1a3c705e
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/main/frontend/components/diff.cljs

+ 5 - 3
src/main/frontend/components/diff.cljs

@@ -16,7 +16,8 @@
             [promesa.core :as p]
             [frontend.github :as github]
             [frontend.diff :as diff]
-            [medley.core :as medley]))
+            [medley.core :as medley]
+            [frontend.encrypt :as encrypt]))
 
 (defonce remote-hash-id (atom nil))
 (defonce diff-state (atom {}))
@@ -162,8 +163,9 @@
               path
               remote-latest-commit
               (fn [{:keys [repo-url path ref content]}]
-                (swap! state/state
-                       assoc-in [:github/contents repo-url remote-latest-commit path] content))
+                (p/let [content (encrypt/decrypt content)]
+                  (swap! state/state
+                        assoc-in [:github/contents repo-url remote-latest-commit path] content)))
               (fn [response]
                 (when (= (gobj/get response "status") 401)
                   (notification/show!