0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-02 04:19:08 -05:00

Add feature naming migration on file importation

This commit is contained in:
Andrey Antukh 2023-11-29 14:48:44 +01:00 committed by Andrés Moya
parent 2c8e29d1df
commit daec51bb7d
2 changed files with 19 additions and 0 deletions

View file

@ -719,6 +719,7 @@
file-id' (lookup-index file-id)
thumbnails (:thumbnails file)
file (update file :features cfeat/migrate-legacy-features)
features (-> enabled-features
(set/difference cfeat/frontend-only-features)

View file

@ -97,6 +97,24 @@
:feature-fdata-pointer-map "fdata/pointer-map"
nil))
(defn migrate-legacy-features
"A helper that translates old feature names to new names"
[features]
(cond-> (or features #{})
(contains? features "storage/pointer-map")
(-> (conj "fdata/pointer-map")
(disj "storage/pointer-map"))
(contains? features "storage/objects-map")
(-> (conj "fdata/objects-map")
(disj "storage/objects-map"))
(or (contains? features "internal/geom-record")
(contains? features "internal/shape-record"))
(-> (conj "fdata/shape-data-type")
(disj "internal/geom-record")
(disj "internal/shape-record"))))
(def xf-supported-features
(filter (partial contains? supported-features)))