mirror of
https://github.com/penpot/penpot.git
synced 2025-07-23 18:47:18 +02:00
Merge pull request #6781 from penpot/niwinz-staging-hotfix-2
🐛 Hot fixes
This commit is contained in:
commit
8e8b2acddd
2 changed files with 35 additions and 19 deletions
|
@ -94,22 +94,33 @@
|
||||||
(defn migrate-file
|
(defn migrate-file
|
||||||
[file libs]
|
[file libs]
|
||||||
(binding [cfeat/*new* (atom #{})]
|
(binding [cfeat/*new* (atom #{})]
|
||||||
(let [version (or (:version file)
|
(let [version
|
||||||
(-> file :data :version))]
|
(or (:version file) (-> file :data :version))
|
||||||
(-> file
|
|
||||||
(assoc :version cfd/version)
|
migrations
|
||||||
(update :migrations
|
(not-empty (get file :migrations))
|
||||||
(fn [migrations]
|
|
||||||
(if (nil? migrations)
|
file
|
||||||
(generate-migrations-from-version version)
|
(-> file
|
||||||
migrations)))
|
(assoc :version cfd/version)
|
||||||
;; NOTE: in some future we can consider to apply
|
(assoc :migrations
|
||||||
;; a migration to the whole database and remove
|
(if migrations
|
||||||
;; this code from this function that executes on
|
migrations
|
||||||
;; each file migration operation
|
(generate-migrations-from-version version)))
|
||||||
(update :features cfeat/migrate-legacy-features)
|
;; NOTE: in some future we can consider to apply a
|
||||||
(migrate libs)
|
;; migration to the whole database and remove this code
|
||||||
(update :features (fnil into #{}) (deref cfeat/*new*))))))
|
;; from this function that executes on each file
|
||||||
|
;; migration operation
|
||||||
|
(update :features cfeat/migrate-legacy-features)
|
||||||
|
(migrate libs)
|
||||||
|
(update :features (fnil into #{}) (deref cfeat/*new*)))]
|
||||||
|
|
||||||
|
;; NOTE: When we have no previous migrations, we report all
|
||||||
|
;; migrations as migrated in order to correctly persist them all
|
||||||
|
;; and not only the really applied migrations
|
||||||
|
(if (not migrations)
|
||||||
|
(vary-meta file assoc ::migrated (:migrations file))
|
||||||
|
file))))
|
||||||
|
|
||||||
(defn migrated?
|
(defn migrated?
|
||||||
[file]
|
[file]
|
||||||
|
@ -1273,7 +1284,8 @@
|
||||||
;; rollback, we still need to perform an other migration
|
;; rollback, we still need to perform an other migration
|
||||||
;; for properly delete the bool-content prop from shapes
|
;; for properly delete the bool-content prop from shapes
|
||||||
;; once the know the migration was OK
|
;; once the know the migration was OK
|
||||||
(if (cfh/bool-shape? object)
|
(if (and (cfh/bool-shape? object)
|
||||||
|
(not (contains? object :content)))
|
||||||
(if-let [content (:bool-content object)]
|
(if-let [content (:bool-content object)]
|
||||||
(assoc object :content content)
|
(assoc object :content content)
|
||||||
object)
|
object)
|
||||||
|
@ -1468,7 +1480,7 @@
|
||||||
(update :pages-index d/update-vals update-container)
|
(update :pages-index d/update-vals update-container)
|
||||||
(d/update-when :components d/update-vals update-container))))
|
(d/update-when :components d/update-vals update-container))))
|
||||||
|
|
||||||
(defmethod migrate-data "0008-fix-library-colors"
|
(defmethod migrate-data "0008-fix-library-colors-v2"
|
||||||
[data _]
|
[data _]
|
||||||
(letfn [(clear-color-opacity [color]
|
(letfn [(clear-color-opacity [color]
|
||||||
(if (and (contains? color :opacity)
|
(if (and (contains? color :opacity)
|
||||||
|
@ -1478,6 +1490,7 @@
|
||||||
|
|
||||||
(clear-color [color]
|
(clear-color [color]
|
||||||
(-> color
|
(-> color
|
||||||
|
(select-keys types.color/library-color-attrs)
|
||||||
(d/without-nils)
|
(d/without-nils)
|
||||||
(d/without-qualified)
|
(d/without-qualified)
|
||||||
(clear-color-opacity)))]
|
(clear-color-opacity)))]
|
||||||
|
@ -1547,4 +1560,4 @@
|
||||||
"0005-deprecate-image-type"
|
"0005-deprecate-image-type"
|
||||||
"0006-fix-old-texts-fills"
|
"0006-fix-old-texts-fills"
|
||||||
"0007-clear-invalid-strokes-and-fills-v2"
|
"0007-clear-invalid-strokes-and-fills-v2"
|
||||||
"0008-fix-library-colors"]))
|
"0008-fix-library-colors-v2"]))
|
||||||
|
|
|
@ -150,6 +150,9 @@
|
||||||
(sm/optional-keys schema:image-color)]
|
(sm/optional-keys schema:image-color)]
|
||||||
[:fn has-valid-color-attrs?]])
|
[:fn has-valid-color-attrs?]])
|
||||||
|
|
||||||
|
(def library-color-attrs
|
||||||
|
(sm/keys schema:library-color-attrs))
|
||||||
|
|
||||||
(def valid-color?
|
(def valid-color?
|
||||||
(sm/lazy-validator schema:color))
|
(sm/lazy-validator schema:color))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue