diff --git a/CHANGES.md b/CHANGES.md index 5631282a0..0e2571b6d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,6 +15,11 @@ ### :bug: Bugs fixed +## 2.4.1 + +### :bug: Bugs fixed + +- Fix error when importing files with touched components [Taiga #9625](https://tree.taiga.io/project/penpot/issue/9625) ## 2.4.0 diff --git a/common/src/app/common/files/defaults.cljc b/common/src/app/common/files/defaults.cljc index fc246030b..50c9ec9cb 100644 --- a/common/src/app/common/files/defaults.cljc +++ b/common/src/app/common/files/defaults.cljc @@ -6,4 +6,4 @@ (ns app.common.files.defaults) -(def version 58) +(def version 60) diff --git a/common/src/app/common/files/migrations.cljc b/common/src/app/common/files/migrations.cljc index bcc0754bc..5449475a3 100644 --- a/common/src/app/common/files/migrations.cljc +++ b/common/src/app/common/files/migrations.cljc @@ -1130,7 +1130,22 @@ (update :pages-index dissoc nil) (update :pages-index update-vals update-page)))) -(defn migrate-up-58 +(defn migrate-up-59 + [data] + (letfn [(fix-touched [elem] + (cond-> elem (string? elem) keyword)) + + (update-shape [shape] + (d/update-when shape :touched #(into #{} (map fix-touched) %))) + + (update-container [container] + (d/update-when container :objects update-vals update-shape))] + + (-> data + (update :pages-index update-vals update-container) + (update :components update-vals update-container)))) + +(defn migrate-up-60 [data] (letfn [(update-object [object] (if (and (:rx object) (not (:r1 object))) @@ -1148,27 +1163,6 @@ (update :pages-index update-vals update-container) (update :components update-vals update-container)))) - -(defn migrate-down-58 - [data] - (letfn [(update-object [object] - (if (= (:r1 object) (:r2 object) (:r3 object) (:r4 object)) - (-> object - (dissoc :r1 :r2 :r3 :r4) - (assoc :rx (:r1 object)) - (assoc :ry (:r1 object))) - object)) - - (update-container [container] - (d/update-when container :objects update-vals update-object))] - - (-> data - (update :pages-index update-vals update-container) - (update :components update-vals update-container)))) - - - - (def migrations "A vector of all applicable migrations" [{:id 2 :migrate-up migrate-up-2} @@ -1218,5 +1212,6 @@ {:id 55 :migrate-up migrate-up-55} {:id 56 :migrate-up migrate-up-56} {:id 57 :migrate-up migrate-up-57} - {:id 58 :migrate-up migrate-up-58 :migrate-down migrate-down-58}]) + {:id 59 :migrate-up migrate-up-59} + {:id 60 :migrate-up migrate-up-60}]) diff --git a/common/src/app/common/types/shape.cljc b/common/src/app/common/types/shape.cljc index dcb1a75dd..28c196227 100644 --- a/common/src/app/common/types/shape.cljc +++ b/common/src/app/common/types/shape.cljc @@ -213,7 +213,8 @@ [:grow-type {:optional true} [::sm/one-of grow-types]] [:applied-tokens {:optional true} ::cto/applied-tokens] - [:plugin-data {:optional true} ::ctpg/plugin-data]]) + [:plugin-data {:optional true} ::ctpg/plugin-data] + [:touched {:optional true} [:maybe [:set :keyword]]]]) (def schema:group-attrs [:map {:title "GroupAttrs"} diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs index 3af7840fd..111ec3cdc 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs @@ -90,8 +90,11 @@ reverse-sort? (= :desc ordering) num-libs (count (mf/deref refs/libraries)) - show-templates-02-test? - (and (cf/external-feature-flag "templates-02" "test") (zero? num-libs)) + show-templates-04-test1? + (and (cf/external-feature-flag "templates-04" "test1") (zero? num-libs)) + + show-templates-04-test2? + (and (cf/external-feature-flag "templates-04" "test2") (zero? num-libs)) toggle-ordering (mf/use-fn @@ -161,11 +164,18 @@ [:article {:class (stl/css :assets-bar)} [:div {:class (stl/css :assets-header)} (when-not ^boolean read-only? - (if show-templates-02-test? + (cond + show-templates-04-test1? + [:button {:class (stl/css :libraries-button) + :on-click show-libraries-dialog + :data-testid "libraries"} + (tr "workspace.assets.add-library")] + show-templates-04-test2? [:button {:class (stl/css :add-library-button) :on-click show-libraries-dialog :data-testid "libraries"} (tr "workspace.assets.add-library")] + :else [:button {:class (stl/css :libraries-button) :on-click show-libraries-dialog :data-testid "libraries"} @@ -173,32 +183,32 @@ i/library] (tr "workspace.assets.libraries")])) - (when-not show-templates-02-test? - [:div {:class (stl/css :search-wrapper)} - [:& search-bar {:on-change on-search-term-change - :value term - :placeholder (tr "workspace.assets.search")} - [:button - {:on-click on-open-menu - :title (tr "workspace.assets.filter") - :class (stl/css-case :section-button true - :opened menu-open?)} - i/filter-icon]] - [:> context-menu* - {:on-close on-menu-close - :selectable true - :selected section - :show menu-open? - :fixed true - :min-width true - :width size - :top 158 - :left 18 - :options options}] - [:> icon-button* {:variant "ghost" - :aria-label (tr "workspace.assets.sort") - :on-click toggle-ordering - :icon (if reverse-sort? "asc-sort" "desc-sort")}]])] + + [:div {:class (stl/css :search-wrapper)} + [:& search-bar {:on-change on-search-term-change + :value term + :placeholder (tr "workspace.assets.search")} + [:button + {:on-click on-open-menu + :title (tr "workspace.assets.filter") + :class (stl/css-case :section-button true + :opened menu-open?)} + i/filter-icon]] + [:> context-menu* + {:on-close on-menu-close + :selectable true + :selected section + :show menu-open? + :fixed true + :min-width true + :width size + :top 158 + :left 18 + :options options}] + [:> icon-button* {:variant "ghost" + :aria-label (tr "workspace.assets.sort") + :on-click toggle-ordering + :icon (if reverse-sort? "asc-sort" "desc-sort")}]]] [:& (mf/provider cmm/assets-filters) {:value filters} [:& (mf/provider cmm/assets-toggle-ordering) {:value toggle-ordering}