mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 23:49:45 -05:00
Merge remote-tracking branch 'origin/main' into develop
This commit is contained in:
commit
b4b12e68bf
3 changed files with 53 additions and 10 deletions
|
@ -63,15 +63,12 @@
|
|||
[cfg {:keys [host version id] :as cdata}]
|
||||
(try
|
||||
(let [uri (:uri cfg)
|
||||
text (str "Unhandled exception:\n"
|
||||
"- detail: " (cfg/get :public-uri) "/dbg/error-by-id/" id "\n"
|
||||
"- profile-id: `" (:profile-id cdata) "`\n"
|
||||
"- host: `" host "`\n"
|
||||
"- version: `" version "`\n")
|
||||
rsp (http/send! {:uri uri
|
||||
:method :post
|
||||
:headers {"content-type" "application/json"}
|
||||
:body (json/encode-str {:text text})})]
|
||||
text (str "Unhandled exception (host: " host ", url: " (cfg/get :public-uri) "/dbg/error-by-id/" id "\n"
|
||||
"- profile-id: #" (:profile-id cdata) "\n")
|
||||
rsp (http/send! {:uri uri
|
||||
:method :post
|
||||
:headers {"content-type" "application/json"}
|
||||
:body (json/encode-str {:text text})})]
|
||||
(when (not= (:status rsp) 200)
|
||||
(l/error :hint "error on sending data to mattermost"
|
||||
:response (pr-str rsp))))
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(:require
|
||||
[app.common.uuid :as uuid]))
|
||||
|
||||
(def file-version 8)
|
||||
(def file-version 11)
|
||||
(def default-color "#b1b2b5") ;; $color-gray-20
|
||||
(def root uuid/zero)
|
||||
|
||||
|
|
|
@ -222,3 +222,49 @@
|
|||
(update :pages-index #(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 %))))
|
||||
|
|
Loading…
Add table
Reference in a new issue