0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-08 16:18:11 -05:00

Merge pull request #3701 from penpot/hiru-migrate-root-shapes

🔧 Add migration to set root shapes as valid objects
This commit is contained in:
Aitor Moreno 2023-10-11 13:21:54 +02:00 committed by GitHub
commit 25c60f3e0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 2 deletions

View file

@ -6,4 +6,4 @@
(ns app.common.files.defaults)
(def version 32)
(def version 33)

View file

@ -608,3 +608,19 @@
(-> data
(update :pages-index update-vals update-container)
(update :components update-vals update-container))))
(defmethod migrate 33
[data]
(letfn [(update-object [object]
; Ensure all root objects are well formed shapes.
(if (= (:id object) uuid/zero)
(-> object
(assoc :parent-id uuid/zero
:frame-id uuid/zero)
(cts/setup-shape))
object))
(update-container [container]
(update container :objects update-vals update-object))]
(-> data
(update :pages-index update-vals update-container))))

View file

@ -394,6 +394,7 @@
(binding [*throw-on-error* throw?
*errors* (volatile! [])]
(->> (ctpl/pages-seq (:data file))
(filter #(some? (:id %)))
(run! #(validate-shape uuid/zero file % libraries :throw? throw?)))
(deref *errors*)))

View file

@ -343,7 +343,6 @@
(->> files (filter #(= (:status %) :importing)) count)
(:importing-templates @state))
warning-files (->> files (filter #(and (= (:status %) :import-finish) (d/not-empty? (:errors %)))) count)
success-files (->> files (filter #(and (= (:status %) :import-finish) (empty? (:errors %)))) count)
pending-analysis? (> (->> files (filter #(= (:status %) :analyzing)) count) 0)