0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-03 21:09:00 -05:00

Merge remote-tracking branch 'origin/main' into develop

This commit is contained in:
Andrey Antukh 2021-07-15 18:08:32 +02:00
commit b4b12e68bf
3 changed files with 53 additions and 10 deletions

View file

@ -63,11 +63,8 @@
[cfg {:keys [host version id] :as cdata}] [cfg {:keys [host version id] :as cdata}]
(try (try
(let [uri (:uri cfg) (let [uri (:uri cfg)
text (str "Unhandled exception:\n" text (str "Unhandled exception (host: " host ", url: " (cfg/get :public-uri) "/dbg/error-by-id/" id "\n"
"- detail: " (cfg/get :public-uri) "/dbg/error-by-id/" id "\n" "- profile-id: #" (:profile-id cdata) "\n")
"- profile-id: `" (:profile-id cdata) "`\n"
"- host: `" host "`\n"
"- version: `" version "`\n")
rsp (http/send! {:uri uri rsp (http/send! {:uri uri
:method :post :method :post
:headers {"content-type" "application/json"} :headers {"content-type" "application/json"}

View file

@ -8,7 +8,7 @@
(:require (:require
[app.common.uuid :as uuid])) [app.common.uuid :as uuid]))
(def file-version 8) (def file-version 11)
(def default-color "#b1b2b5") ;; $color-gray-20 (def default-color "#b1b2b5") ;; $color-gray-20
(def root uuid/zero) (def root uuid/zero)

View file

@ -222,3 +222,49 @@
(update :pages-index #(d/mapm clean-container %)) (update :pages-index #(d/mapm clean-container %))
(d/update-when :components #(d/mapm clean-container %))))) (d/update-when :components #(d/mapm clean-container %)))))
(defmethod migrate 9
[data]
(letfn [(find-empty-groups [objects]
(->> (vals objects)
(filter (fn [shape]
(and (= :group (:type shape))
(or (empty? (:shapes shape))
(every? (fn [child-id]
(not (contains? objects child-id)))
(:shapes shape))))))
(map :id)))
(calculate-changes [[page-id page]]
(let [objects (:objects page)
eids (find-empty-groups objects)]
(map (fn [id]
{:type :del-obj
:page-id page-id
:id id})
eids)))]
(loop [data data]
(let [changes (mapcat calculate-changes (:pages-index data))]
(if (seq changes)
(recur (cp/process-changes data changes))
data)))))
(defmethod migrate 10
[data]
(letfn [(update-page [_ page]
(d/update-in-when page [:objects uuid/zero] dissoc :points :selrect))]
(update data :pages-index #(d/mapm update-page %))))
(defmethod migrate 11
[data]
(letfn [(update-object [objects id shape]
(if (= :frame (:type shape))
(d/update-when shape :shapes (fn [shapes]
(filterv (fn [id] (contains? objects id)) shapes)))
shape))
(update-page [_ page]
(update page :objects #(d/mapm (partial update-object %) %)))]
(update data :pages-index #(d/mapm update-page %))))