From 1b31a02c14811f4924b7c6a4c4e257332e184f02 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 24 Jul 2023 09:46:30 +0200 Subject: [PATCH 1/4] :bug: Fix when user deletes one file during import it is impossible to finish importing of second file --- CHANGES.md | 1 + frontend/src/app/main/ui/dashboard/import.cljs | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index fd77dae98b..5edc09ba23 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -86,6 +86,7 @@ - Fix problem with precision in resizes [Taiga #5623](https://tree.taiga.io/project/penpot/issue/5623) - Fix absolute positioned layouts not showing flex properties [Taiga #5630](https://tree.taiga.io/project/penpot/issue/5630) - Fix text gradient handlers [Taiga #4047](https://tree.taiga.io/project/penpot/issue/4047) +- Fix when user deletes one file during import it is impossible to finish importing of second file [Taiga #5656](https://tree.taiga.io/project/penpot/issue/5656) ### :arrow_up: Deps updates diff --git a/frontend/src/app/main/ui/dashboard/import.cljs b/frontend/src/app/main/ui/dashboard/import.cljs index 1aa8fbc730..5a24b393a2 100644 --- a/frontend/src/app/main/ui/dashboard/import.cljs +++ b/frontend/src/app/main/ui/dashboard/import.cljs @@ -337,18 +337,18 @@ (st/emit! (modal/hide)) (when on-finish-import (on-finish-import)))) + files (->> (:files @state) (filterv (comp not :deleted?))) + num-importing (+ - (->> @state :files (filter #(= (:status %) :importing)) count) + (->> files (filter #(= (:status %) :importing)) count) (:importing-templates @state)) - warning-files (->> @state :files (filter #(and (= (:status %) :import-finish) (d/not-empty? (:errors %)))) count) - success-files (->> @state :files (filter #(and (= (:status %) :import-finish) (empty? (:errors %)))) count) - pending-analysis? (> (->> @state :files (filter #(= (:status %) :analyzing)) count) 0) + warning-files (->> files (filter #(and (= (:status %) :import-finish) (d/not-empty? (:errors %)))) count) + success-files (->> files (filter #(and (= (:status %) :import-finish) (empty? (:errors %)))) count) + pending-analysis? (> (->> files (filter #(= (:status %) :analyzing)) count) 0) pending-import? (> num-importing 0) - files (->> (:files @state) (filterv (comp not :deleted?))) - ;; pending-import? (> (->> @state :files (filter #(= (:status %) :importing)) count) 0) - ;; files (->> (:files @state) (filterv (comp not :deleted?))) + valid-files? (or (some? template) (> (+ (->> files (filterv (fn [x] (not= (:status x) :analyze-error))) count)) 0))] From db7c4a926581c24662a5de44f27d4fdac898293a Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 24 Jul 2023 12:53:58 +0200 Subject: [PATCH 2/4] :bug: Fix export multiple images when only one of them has export settings --- CHANGES.md | 1 + .../sidebar/options/menus/exports.cljs | 41 +++++++++++++------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 5edc09ba23..20c84c94bb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -87,6 +87,7 @@ - Fix absolute positioned layouts not showing flex properties [Taiga #5630](https://tree.taiga.io/project/penpot/issue/5630) - Fix text gradient handlers [Taiga #4047](https://tree.taiga.io/project/penpot/issue/4047) - Fix when user deletes one file during import it is impossible to finish importing of second file [Taiga #5656](https://tree.taiga.io/project/penpot/issue/5656) +- Fix export multiple images when only one of them has export settings [Taiga #5649](https://tree.taiga.io/project/penpot/issue/5649) ### :arrow_up: Deps updates diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/exports.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/exports.cljs index 191051640a..879c49173d 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/exports.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/exports.cljs @@ -26,18 +26,20 @@ (mf/defc exports-menu {::mf/wrap [#(mf/memo' % (mf/check-props ["ids" "values" "type" "page-id" "file-id"]))]} [{:keys [ids type values page-id file-id] :as props}] - (let [exports (:exports values []) + (let [exports (:exports values []) - state (mf/deref refs/export) - in-progress? (:in-progress state) + state (mf/deref refs/export) + in-progress? (:in-progress state) - sname (when (seqable? exports) - (let [shapes (wsh/lookup-shapes @st/state ids) - sname (-> shapes first :name) - suffix (-> exports first :suffix)] - (cond-> sname - (and (= 1 (count exports)) (some? suffix)) - (str suffix)))) + shapes-with-exports (->> (wsh/lookup-shapes @st/state ids) + (filter #(pos? (count (:exports %))))) + + sname (when (seqable? exports) + (let [sname (-> shapes-with-exports first :name) + suffix (-> exports first :suffix)] + (cond-> sname + (and (= 1 (count exports)) (some? suffix)) + (str suffix)))) scale-enabled? (mf/use-callback @@ -50,7 +52,22 @@ (fn [event] (dom/prevent-default event) (if (= :multiple type) - (st/emit! (de/show-workspace-export-dialog {:selected (reverse ids)})) + ;; I can select multiple shapes all of them with no export settings and one of them with only one + ;; In that situation we must export it directly + (if (and (= 1 (count shapes-with-exports)) (= 1 (-> shapes-with-exports first :exports count))) + (let [shape (-> shapes-with-exports first) + export (-> shape :exports first) + sname (:name shape) + suffix (:suffix export) + defaults {:page-id page-id + :file-id file-id + :name sname + :object-id (:id (first shapes-with-exports))}] + (cond-> sname + (some? suffix) + (str suffix)) + (st/emit! (de/request-simple-export {:export (merge export defaults)}))) + (st/emit! (de/show-workspace-export-dialog {:selected (reverse ids)}))) ;; In other all cases we only allowed to have a single ;; shape-id because multiple shape-ids are handled @@ -182,4 +199,4 @@ :disabled in-progress?} (if in-progress? (tr "workspace.options.exporting-object") - (tr "workspace.options.export-object" (c (count ids))))])])) + (tr "workspace.options.export-object" (c (count shapes-with-exports))))])])) From ea2e25b46d39cb906180b860a9734564e54d2f6a Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 24 Jul 2023 13:27:19 +0200 Subject: [PATCH 3/4] :bug: Making old-password non required again --- backend/src/app/rpc/commands/profile.clj | 3 ++- frontend/src/app/main/data/users.cljs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/src/app/rpc/commands/profile.clj b/backend/src/app/rpc/commands/profile.clj index 56b352ffcd..c79e4c773e 100644 --- a/backend/src/app/rpc/commands/profile.clj +++ b/backend/src/app/rpc/commands/profile.clj @@ -133,7 +133,8 @@ (def schema:update-profile-password [:map {:title "update-profile-password"} [:password [::sm/word-string {:max 500}]] - [:old-password [::sm/word-string {:max 500}]]]) + ;; Social registered users don't have old-password + [:old-password {:optional true} [:maybe [::sm/word-string {:max 500}]]]]) (sv/defmethod ::update-profile-password {:doc/added "1.0" diff --git a/frontend/src/app/main/data/users.cljs b/frontend/src/app/main/data/users.cljs index 9e042aa9b6..92d2e8bb18 100644 --- a/frontend/src/app/main/data/users.cljs +++ b/frontend/src/app/main/data/users.cljs @@ -337,7 +337,8 @@ [:map {:closed true} [:password-1 :string] [:password-2 :string] - [:password-old :string]]) + ;; Social registered users don't have old-password + [:password-old {:optional true} [:maybe :string]]]) (defn update-password [data] From ec131382b37eb5672e6306d99101139ecd26c9dd Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 24 Jul 2023 15:39:22 +0200 Subject: [PATCH 4/4] :bug: Fix error when a user different than the thread creator edits a comment --- CHANGES.md | 1 + backend/src/app/rpc/commands/comments.clj | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 20c84c94bb..ff0d415f65 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -88,6 +88,7 @@ - Fix text gradient handlers [Taiga #4047](https://tree.taiga.io/project/penpot/issue/4047) - Fix when user deletes one file during import it is impossible to finish importing of second file [Taiga #5656](https://tree.taiga.io/project/penpot/issue/5656) - Fix export multiple images when only one of them has export settings [Taiga #5649](https://tree.taiga.io/project/penpot/issue/5649) +- Fix error when a user different than the thread creator edits a comment [Taiga #5647](https://tree.taiga.io/project/penpot/issue/5647) ### :arrow_up: Deps updates diff --git a/backend/src/app/rpc/commands/comments.clj b/backend/src/app/rpc/commands/comments.clj index e91529a3b2..b8352f6220 100644 --- a/backend/src/app/rpc/commands/comments.clj +++ b/backend/src/app/rpc/commands/comments.clj @@ -468,8 +468,8 @@ {::doc/added "1.15"} [{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id ::rpc/request-at id share-id content] :as params}] (db/with-atomic [conn pool] - (let [{:keys [thread-id] :as comment} (get-comment conn id ::db/for-update? true) - {:keys [file-id page-id owner-id] :as thread} (get-comment-thread conn thread-id ::db/for-update? true)] + (let [{:keys [thread-id owner-id] :as comment} (get-comment conn id ::db/for-update? true) + {:keys [file-id page-id] :as thread} (get-comment-thread conn thread-id ::db/for-update? true)] (files/check-comment-permissions! conn profile-id file-id share-id)