mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 09:08:31 -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:
commit
25c60f3e0f
4 changed files with 18 additions and 2 deletions
|
@ -6,4 +6,4 @@
|
||||||
|
|
||||||
(ns app.common.files.defaults)
|
(ns app.common.files.defaults)
|
||||||
|
|
||||||
(def version 32)
|
(def version 33)
|
||||||
|
|
|
@ -608,3 +608,19 @@
|
||||||
(-> data
|
(-> data
|
||||||
(update :pages-index update-vals update-container)
|
(update :pages-index update-vals update-container)
|
||||||
(update :components 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))))
|
||||||
|
|
|
@ -394,6 +394,7 @@
|
||||||
(binding [*throw-on-error* throw?
|
(binding [*throw-on-error* throw?
|
||||||
*errors* (volatile! [])]
|
*errors* (volatile! [])]
|
||||||
(->> (ctpl/pages-seq (:data file))
|
(->> (ctpl/pages-seq (:data file))
|
||||||
|
(filter #(some? (:id %)))
|
||||||
(run! #(validate-shape uuid/zero file % libraries :throw? throw?)))
|
(run! #(validate-shape uuid/zero file % libraries :throw? throw?)))
|
||||||
|
|
||||||
(deref *errors*)))
|
(deref *errors*)))
|
||||||
|
|
|
@ -343,7 +343,6 @@
|
||||||
(->> files (filter #(= (:status %) :importing)) count)
|
(->> files (filter #(= (:status %) :importing)) count)
|
||||||
(:importing-templates @state))
|
(:importing-templates @state))
|
||||||
|
|
||||||
|
|
||||||
warning-files (->> files (filter #(and (= (:status %) :import-finish) (d/not-empty? (:errors %)))) count)
|
warning-files (->> files (filter #(and (= (:status %) :import-finish) (d/not-empty? (:errors %)))) count)
|
||||||
success-files (->> files (filter #(and (= (:status %) :import-finish) (empty? (:errors %)))) count)
|
success-files (->> files (filter #(and (= (:status %) :import-finish) (empty? (:errors %)))) count)
|
||||||
pending-analysis? (> (->> files (filter #(= (:status %) :analyzing)) count) 0)
|
pending-analysis? (> (->> files (filter #(= (:status %) :analyzing)) count) 0)
|
||||||
|
|
Loading…
Add table
Reference in a new issue