From 6237829445221fa2057c49cd0b55622b7bc0c275 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 1 Aug 2022 15:01:03 +0200 Subject: [PATCH 1/6] :paperclip: Add additional reformating to specs naming --- backend/src/app/config.clj | 10 +++++----- backend/src/app/http/assets.clj | 2 +- backend/src/app/http/debug.clj | 3 +-- backend/src/app/rpc/mutations/teams.clj | 4 ++-- common/src/app/common/spec.cljc | 15 ++++++++------- frontend/src/app/main/data/dashboard.cljs | 6 +++--- frontend/src/app/main/ui/dashboard/team.cljs | 2 +- .../src/app/main/ui/onboarding/team_choice.cljs | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/backend/src/app/config.clj b/backend/src/app/config.clj index 10bc7e4b7..e61d7dd49 100644 --- a/backend/src/app/config.clj +++ b/backend/src/app/config.clj @@ -84,7 +84,7 @@ ;; a server prop key where initial project is stored. :initial-project-skey "initial-project"}) -(s/def ::flags ::us/vec-of-keywords) +(s/def ::flags ::us/vec-of-valid-keywords) ;; DEPRECATED PROPERTIES (s/def ::telemetry-enabled ::us/boolean) @@ -93,7 +93,7 @@ (s/def ::audit-log-archive-uri ::us/string) (s/def ::audit-log-gc-max-age ::dt/duration) -(s/def ::admins ::us/set-of-str) +(s/def ::admins ::us/set-of-non-empty-strings) (s/def ::file-change-snapshot-every ::us/integer) (s/def ::file-change-snapshot-timeout ::dt/duration) @@ -128,8 +128,8 @@ (s/def ::oidc-token-uri ::us/string) (s/def ::oidc-auth-uri ::us/string) (s/def ::oidc-user-uri ::us/string) -(s/def ::oidc-scopes ::us/set-of-str) -(s/def ::oidc-roles ::us/set-of-str) +(s/def ::oidc-scopes ::us/set-of-non-empty-strings) +(s/def ::oidc-roles ::us/set-of-non-empty-strings) (s/def ::oidc-roles-attr ::us/keyword) (s/def ::oidc-email-attr ::us/keyword) (s/def ::oidc-name-attr ::us/keyword) @@ -165,7 +165,7 @@ (s/def ::profile-complaint-threshold ::us/integer) (s/def ::public-uri ::us/string) (s/def ::redis-uri ::us/string) -(s/def ::registration-domain-whitelist ::us/set-of-str) +(s/def ::registration-domain-whitelist ::us/set-of-non-empty-strings) (s/def ::rlimit-font ::us/integer) (s/def ::rlimit-file-update ::us/integer) (s/def ::rlimit-image ::us/integer) diff --git a/backend/src/app/http/assets.clj b/backend/src/app/http/assets.clj index 9061c436d..39a55c719 100644 --- a/backend/src/app/http/assets.clj +++ b/backend/src/app/http/assets.clj @@ -29,7 +29,7 @@ (defn coerce-id [id] - (let [res (us/uuid-conformer id)] + (let [res (parse-uuid id)] (when-not (uuid? res) (ex/raise :type :not-found :hint "object not found")) diff --git a/backend/src/app/http/debug.clj b/backend/src/app/http/debug.clj index 1b1002dce..11a29f892 100644 --- a/backend/src/app/http/debug.clj +++ b/backend/src/app/http/debug.clj @@ -9,7 +9,6 @@ (:require [app.common.exceptions :as ex] [app.common.pprint :as pp] - [app.common.spec :as us] [app.common.uuid :as uuid] [app.config :as cf] [app.db :as db] @@ -205,7 +204,7 @@ [{:keys [pool]} request] (letfn [(parse-id [request] (let [id (get-in request [:path-params :id]) - id (us/uuid-conformer id)] + id (parse-uuid id)] (when (uuid? id) id))) diff --git a/backend/src/app/rpc/mutations/teams.clj b/backend/src/app/rpc/mutations/teams.clj index 4657a425a..7be2a96aa 100644 --- a/backend/src/app/rpc/mutations/teams.clj +++ b/backend/src/app/rpc/mutations/teams.clj @@ -353,7 +353,7 @@ (declare create-team-invitation) (s/def ::email ::us/email) -(s/def ::emails ::us/set-of-emails) +(s/def ::emails ::us/set-of-valid-emails) (s/def ::invite-team-member (s/keys :req-un [::profile-id ::team-id ::role] :opt-un [::email ::emails])) @@ -443,7 +443,7 @@ ;; --- Mutation: Create Team & Invite Members -(s/def ::emails ::us/set-of-emails) +(s/def ::emails ::us/set-of-valid-emails) (s/def ::create-team-and-invite-members (s/and ::create-team (s/keys :req-un [::emails ::role]))) diff --git a/common/src/app/common/spec.cljc b/common/src/app/common/spec.cljc index 96ee8aee9..2f280abfe 100644 --- a/common/src/app/common/spec.cljc +++ b/common/src/app/common/spec.cljc @@ -133,7 +133,7 @@ (dm/str v))] (s/def ::rgb-color-str (s/conformer conformer unformer))) -;; --- SPEC: set of Keywords +;; --- SPEC: set/vec of valid Keywords (letfn [(conform-fn [dest s] (let [xform (keep (fn [s] @@ -146,17 +146,17 @@ (string? s) (into dest xform (str/words s)) :else ::s/invalid)))] - (s/def ::set-of-keywords + (s/def ::set-of-valid-keywords (s/conformer (fn [s] (conform-fn #{} s)) (fn [s] (str/join " " (map name s))))) - (s/def ::vec-of-keywords + (s/def ::vec-of-valid-keywords (s/conformer (fn [s] (conform-fn [] s)) (fn [s] (str/join " " (map name s)))))) -;; --- SPEC: set-of-emails +;; --- SPEC: set-of-valid-emails (letfn [(conformer [v] (cond @@ -171,9 +171,9 @@ :else ::s/invalid)) (unformer [v] (str/join " " v))] - (s/def ::set-of-emails (s/conformer conformer unformer))) + (s/def ::set-of-valid-emails (s/conformer conformer unformer))) -;; --- SPEC: set-of-str +;; --- SPEC: set-of-non-empty-strings (def non-empty-strings-xf (comp @@ -189,7 +189,7 @@ :else ::s/invalid)) (unformer [s] (str/join "," s))] - (s/def ::set-of-str (s/conformer conformer unformer))) + (s/def ::set-of-non-empty-strings (s/conformer conformer unformer))) ;; --- SPECS WITHOUT CONFORMER @@ -200,6 +200,7 @@ (s/def ::fn fn?) (s/def ::id ::uuid) +(s/def ::set-of-string (s/every ::string :kind set?)) (s/def ::coll-of-uuid (s/every ::uuid)) (defn bytes? diff --git a/frontend/src/app/main/data/dashboard.cljs b/frontend/src/app/main/data/dashboard.cljs index e51ed446c..05f5a20af 100644 --- a/frontend/src/app/main/data/dashboard.cljs +++ b/frontend/src/app/main/data/dashboard.cljs @@ -427,9 +427,9 @@ (defn invite-team-members [{:keys [emails role team-id resend?] :as params}] - (us/assert ::us/set-of-emails emails) - (us/assert ::us/keyword role) - (us/assert ::us/uuid team-id) + (us/assert! ::us/set-of-valid-emails emails) + (us/assert! ::us/keyword role) + (us/assert! ::us/uuid team-id) (ptk/reify ::invite-team-members IDeref (-deref [_] {:role role :team-id team-id :resend? resend?}) diff --git a/frontend/src/app/main/ui/dashboard/team.cljs b/frontend/src/app/main/ui/dashboard/team.cljs index 939b6e2d1..4281a8219 100644 --- a/frontend/src/app/main/ui/dashboard/team.cljs +++ b/frontend/src/app/main/ui/dashboard/team.cljs @@ -77,7 +77,7 @@ ] (filterv identity))) -(s/def ::emails (s/and ::us/set-of-emails d/not-empty?)) +(s/def ::emails (s/and ::us/set-of-valid-emails d/not-empty?)) (s/def ::role ::us/keyword) (s/def ::team-id ::us/uuid) diff --git a/frontend/src/app/main/ui/onboarding/team_choice.cljs b/frontend/src/app/main/ui/onboarding/team_choice.cljs index 77cc59f0f..43c62616a 100644 --- a/frontend/src/app/main/ui/onboarding/team_choice.cljs +++ b/frontend/src/app/main/ui/onboarding/team_choice.cljs @@ -102,7 +102,7 @@ [{:value "editor" :label (tr "labels.editor")} {:value "admin" :label (tr "labels.admin")}]) -(s/def ::emails (s/and ::us/set-of-emails d/not-empty?)) +(s/def ::emails (s/and ::us/set-of-valid-emails d/not-empty?)) (s/def ::role ::us/keyword) (s/def ::invite-form (s/keys :req-un [::role ::emails])) From 39ae2ed98df3c3719b92de499b4abfdaa7b9d773 Mon Sep 17 00:00:00 2001 From: Andrew Zhurov Date: Mon, 1 Aug 2022 11:10:09 +0300 Subject: [PATCH 2/6] :bug: Fix svg upload Signed-off-by: Andrei Zhurau --- backend/src/app/rpc/mutations/media.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/app/rpc/mutations/media.clj b/backend/src/app/rpc/mutations/media.clj index 66ef41da6..1a344289d 100644 --- a/backend/src/app/rpc/mutations/media.clj +++ b/backend/src/app/rpc/mutations/media.clj @@ -134,7 +134,7 @@ :bucket "file-media-object"})))) (create-image [info] - (p/let [data (cond-> (:path info) (= (:mtype info) "image/svg+xml") slurp) + (p/let [data (:path info) hash (calculate-hash data) content (-> (sto/content data) (sto/wrap-with-hash hash))] From 64217b34caf57af777e900d6a1af206461fa4679 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Tue, 2 Aug 2022 10:22:08 +0200 Subject: [PATCH 3/6] :bug: Fix copy and paste layers order --- CHANGES.md | 3 ++- frontend/src/app/main/data/workspace.cljs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 1a9713d0a..909f62349 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -38,7 +38,8 @@ - Fix moving frame-guides outside frames [Taiga #3839](https://tree.taiga.io/project/penpot/issue/3839) - Fix problem with 180 degree rotations [#2082](https://github.com/penpot/penpot/issues/2082) - Fix font rendering on grid thumbnails [Taiga #3473](https://tree.taiga.io/project/penpot/issue/3473) -- Fix Drag and drop font assets in groups +- Fix Drag and drop font assets in groups [Taiga #3763](https://tree.taiga.io/project/penpot/issue/3763) +- Fix copy and paste layers order [Taiga #1617](https://tree.taiga.io/project/penpot/issue/1617) ### :arrow_up: Deps updates ### :heart: Community contributions by (Thank you!) diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index 397d3824e..c333f8874 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -1087,6 +1087,7 @@ objects (cph/selected-subtree objects selected) selected (->> (cph/sort-z-index objects selected) + (reverse) (into (d/ordered-set)))] (assoc data :selected selected))) From 424e9faa8ee8fe3049e65d81bba653555fc0ffb8 Mon Sep 17 00:00:00 2001 From: Andrew Zhurov Date: Wed, 27 Jul 2022 20:44:21 +0300 Subject: [PATCH 4/6] :bug: Fix paste frame removes all guides Signed-off-by: Andrei Zhurau --- frontend/src/app/main/data/workspace/selection.cljs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 777a5d49c..dbc2a68ba 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -425,11 +425,9 @@ (assoc :position (if (= (:axis %) :x) (+ (:position %) (- (:x new-frame) (:x frame))) (+ (:position %) (- (:y new-frame) (:y frame))))))))] - - (if-not (empty? new-guides) - (conj g - (into {} (map (juxt :id identity) new-guides))) - {}))) + (cond-> g + (not-empty new-guides) + (conj (into {} (map (juxt :id identity) new-guides)))))) guides frames)] (-> (pcb/with-page changes page) From 732755066e5decdd013a97924d050bda4e803d58 Mon Sep 17 00:00:00 2001 From: Andrew Zhurov Date: Sun, 31 Jul 2022 10:33:10 +0300 Subject: [PATCH 5/6] :bug: Fix text alignment becoming undefined on pasting text from clipboard Signed-off-by: Andrei Zhurau --- frontend/src/app/util/text_editor_impl.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/frontend/src/app/util/text_editor_impl.js b/frontend/src/app/util/text_editor_impl.js index 6a8cbc178..c032a90fe 100644 --- a/frontend/src/app/util/text_editor_impl.js +++ b/frontend/src/app/util/text_editor_impl.js @@ -378,10 +378,7 @@ export function insertText(state, text, attrs, inlineStyles) { ); blockArray = blockArray.map((b) => { - if (b.getText() === "") { - return mergeBlockData(b, attrs) - } - return b; + return mergeBlockData(b, attrs); }); const fragment = BlockMapBuilder.createFromArray(blockArray); From 0cc51db53373fe997eeb2b6709af23bc2099aeae Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 3 Aug 2022 09:26:29 +0200 Subject: [PATCH 6/6] :paperclip: Update changelog --- CHANGES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 909f62349..5b67cb8b6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -40,6 +40,9 @@ - Fix font rendering on grid thumbnails [Taiga #3473](https://tree.taiga.io/project/penpot/issue/3473) - Fix Drag and drop font assets in groups [Taiga #3763](https://tree.taiga.io/project/penpot/issue/3763) - Fix copy and paste layers order [Taiga #1617](https://tree.taiga.io/project/penpot/issue/1617) +- Fix unexpected removal of guides on copy&paste frames [Taiga #3887](https://tree.taiga.io/project/penpot/issue/3887) by @andrewzhurov +- Fix props preserving on copy&paste texts [Taiga #3629](https://tree.taiga.io/project/penpot/issue/3629) by @andrewzhurov + ### :arrow_up: Deps updates ### :heart: Community contributions by (Thank you!)