From 137e576e63346e5f14035c2f6a2dcabfc64352a5 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Fri, 12 Apr 2024 12:00:50 +0200 Subject: [PATCH 1/8] :bug: Fix scrollbar appears on top of UI buttons --- .../src/app/main/ui/components/tab_container.scss | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/frontend/src/app/main/ui/components/tab_container.scss b/frontend/src/app/main/ui/components/tab_container.scss index 80e5b3ea69..c01715bd42 100644 --- a/frontend/src/app/main/ui/components/tab_container.scss +++ b/frontend/src/app/main/ui/components/tab_container.scss @@ -46,6 +46,7 @@ @extend .button-icon; stroke: var(--tab-foreground-color); } + .content { @include headlineSmallTypography; text-align: center; @@ -53,17 +54,21 @@ overflow: hidden; text-overflow: ellipsis; } + &.current, &.current:hover { background: var(--tab-background-color-selected); border-color: var(--tab-border-color-selected); color: var(--tab-foreground-color-selected); + svg { stroke: var(--tab-foreground-color-selected); } } + &:hover { color: var(--tab-foreground-color-hover); + svg { stroke: var(--tab-foreground-color-hover); } @@ -78,6 +83,7 @@ min-width: $s-24; padding: 0 $s-6; border-radius: $br-5; + svg { @include flexCenter; height: $s-16; @@ -87,6 +93,7 @@ fill: none; color: transparent; } + &:hover { svg { stroke: var(--icon-foreground-hover); @@ -107,3 +114,10 @@ display: flex; flex-direction: column; } + +//Firefox doesn't respect scrollbar-gutter +@supports (-moz-appearance: none) { + .tab-container-content { + padding-right: $s-8; + } +} From a7a33440309260ab41b55b59d642169e3302d84e Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Fri, 12 Apr 2024 12:51:53 +0200 Subject: [PATCH 2/8] :bug: Inverted highlight constraint for vertical and horizontal constraints --- .../ui/workspace/sidebar/options/menus/constraints.cljs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/constraints.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/constraints.cljs index ce3bdedca6..866249bcc9 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/constraints.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/constraints.cljs @@ -181,14 +181,14 @@ [:span {:class (stl/css :resalted-area)}]]] [:div {:class (stl/css :constraints-center)} [:button {:class (stl/css-case :constraint-btn true - :active (= constraints-h :center)) - :data-value "centerh" + :active (= constraints-v :center)) + :data-value "centerv" :on-click on-constraint-button-clicked} [:span {:class (stl/css :resalted-area)}]] [:button {:class (stl/css-case :constraint-btn-special true :constraint-btn-rotated true - :active (= constraints-v :center)) - :data-value "centerv" + :active (= constraints-h :center)) + :data-value "centerh" :on-click on-constraint-button-clicked} [:span {:class (stl/css :resalted-area)}]]] [:div {:class (stl/css :constraints-right)} From e636bdd0b0ec0771c4236bb23e0d045f881a311a Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 12 Apr 2024 11:47:43 +0200 Subject: [PATCH 3/8] :bug: Fix problem copy/paste svg text --- frontend/src/app/main/data/workspace.cljs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index 52aef6249e..1f48ae4ed0 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -1711,8 +1711,14 @@ (process-entry [[type data]] (case type :text - (if (str/empty? data) + (cond + (str/empty? data) (rx/empty) + + (re-find #" pdata wapi/extract-text) transit-data (ex/ignoring (some-> text-data t/decode-str))] (cond - (and (string? text-data) - (str/includes? text-data " Date: Fri, 12 Apr 2024 12:41:55 +0200 Subject: [PATCH 4/8] :bug: Fix crash when removing multiple text fills --- .../workspace/sidebar/options/menus/fill.cljs | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/fill.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/fill.cljs index 82e8fe530b..7dfc6f0758 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/fill.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/fill.cljs @@ -69,33 +69,34 @@ on-add (mf/use-fn - (mf/deps ids) + (mf/deps ids fills) (fn [_] (st/emit! (dc/add-fill ids {:color default-color :opacity 1})) - (when (not (some? (seq fills))) (open-content)))) + (when (or (= :multiple fills) + (not (some? (seq fills)))) + (open-content)))) on-change - (mf/use-fn - (mf/deps ids) - (fn [index] - (fn [color] - (st/emit! (dc/change-fill ids color index))))) + (fn [index] + (fn [color] + (st/emit! (dc/change-fill ids color index)))) on-reorder - (mf/use-fn - (mf/deps ids) - (fn [new-index] - (fn [index] - (st/emit! (dc/reorder-fills ids index new-index))))) + (fn [new-index] + (fn [index] + (st/emit! (dc/reorder-fills ids index new-index)))) on-remove (fn [index] (fn [] (st/emit! (dc/remove-fill ids {:color default-color :opacity 1} index)) - (when (= 1 (count (seq fills))) (close-content)))) + (when (or (= :multiple fills) + (= 1 (count (seq fills)))) + (close-content)))) + on-remove-all (fn [_] (st/emit! (dc/remove-all-fills ids {:color clr/black From 8e71d219ca1cf4ba7b2b7eb1334b9afd7245da77 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 12 Apr 2024 12:42:08 +0200 Subject: [PATCH 5/8] :bug: Fix editor when several colors are in a single word --- frontend/resources/styles/main/partials/texts.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/resources/styles/main/partials/texts.scss b/frontend/resources/styles/main/partials/texts.scss index 0bece2924d..ad53796b62 100644 --- a/frontend/resources/styles/main/partials/texts.scss +++ b/frontend/resources/styles/main/partials/texts.scss @@ -21,6 +21,10 @@ flex-direction: column; } + .public-DraftStyleDefault-block { + white-space: pre; + } + &.align-top { .DraftEditor-root { justify-content: flex-start; From 4838571ec2331bbb34c704386a865b01086604a0 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 12 Apr 2024 15:21:30 +0200 Subject: [PATCH 6/8] :bug: Fix problem with position-data overriding in copies --- .../main/data/workspace/libraries_helpers.cljs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/data/workspace/libraries_helpers.cljs b/frontend/src/app/main/data/workspace/libraries_helpers.cljs index f6de7fb462..ff03da46e9 100644 --- a/frontend/src/app/main/data/workspace/libraries_helpers.cljs +++ b/frontend/src/app/main/data/workspace/libraries_helpers.cljs @@ -1491,9 +1491,22 @@ container {:type :reg-objects :shapes all-parents})])))) - (let [roperation {:type :set + (let [;; position-data is a special case because can be affected by :geometry-group and :content-group + ;; so, if the position-data changes but the geometry is touched we need to reset the position-data + ;; so it's calculated again + reset-pos-data? + (and (cfh/text-shape? origin-shape) + (= attr :position-data) + (not= (get origin-shape attr) (get dest-shape attr)) + (touched :geometry-group)) + + roperation {:type :set :attr attr - :val (get origin-shape attr) + :val (cond + ;; If position data changes and the geometry group is touched + ;; we need to put to nil so we can regenerate it + reset-pos-data? nil + :else (get origin-shape attr)) :ignore-touched true} uoperation {:type :set :attr attr From 0135b477cab241860b95ce07535c487ad6d89217 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 15 Apr 2024 14:09:22 +0200 Subject: [PATCH 7/8] :sparkles: Add improved traceability of climit module --- backend/src/app/rpc/climit.clj | 117 +++++++++++++---------- backend/src/app/rpc/commands/media.clj | 5 +- backend/src/app/rpc/commands/profile.clj | 8 +- 3 files changed, 71 insertions(+), 59 deletions(-) diff --git a/backend/src/app/rpc/climit.clj b/backend/src/app/rpc/climit.clj index 7dbec08619..3ca348e0b9 100644 --- a/backend/src/app/rpc/climit.clj +++ b/backend/src/app/rpc/climit.clj @@ -20,6 +20,7 @@ [app.util.time :as dt] [app.worker :as-alias wrk] [clojure.edn :as edn] + [clojure.set :as set] [clojure.spec.alpha :as s] [datoteka.fs :as fs] [integrant.core :as ig] @@ -91,67 +92,77 @@ :timeout (:timeout config) :type :semaphore)) -(defmacro ^:private measure-and-log! - [metrics mlabels stats id action limit-id limit-label profile-id elapsed] - `(let [mpermits# (:max-permits ~stats) - mqueue# (:max-queue ~stats) - permits# (:permits ~stats) - queue# (:queue ~stats) - queue# (- queue# mpermits#) - queue# (if (neg? queue#) 0 queue#) - level# (if (pos? queue#) :warn :trace)] - (mtx/run! ~metrics - :id :rpc-climit-queue - :val queue# - :labels ~mlabels) +(defn measure! + [metrics mlabels stats elapsed] + (let [mpermits (:max-permits stats) + permits (:permits stats) + queue (:queue stats) + queue (- queue mpermits) + queue (if (neg? queue) 0 queue)] - (mtx/run! ~metrics - :id :rpc-climit-permits - :val permits# - :labels ~mlabels) + (mtx/run! metrics + :id :rpc-climit-queue + :val queue + :labels mlabels) - (l/log level# - :hint ~action - :req ~id - :id ~limit-id - :label ~limit-label - :profile-id (str ~profile-id) - :permits permits# - :queue queue# - :max-permits mpermits# - :max-queue mqueue# - ~@(if (some? elapsed) - [:elapsed `(dt/format-duration ~elapsed)] - [])))) + (mtx/run! metrics + :id :rpc-climit-permits + :val permits + :labels mlabels) + + (when elapsed + (mtx/run! metrics + :id :rpc-climit-timing + :val (inst-ms elapsed) + :labels mlabels)))) + +(defn log! + [action req-id stats limit-id limit-label params elapsed] + (let [mpermits (:max-permits stats) + queue (:queue stats) + queue (- queue mpermits) + queue (if (neg? queue) 0 queue) + level (if (pos? queue) :warn :trace)] + + (l/log level + :hint action + :req req-id + :id limit-id + :label limit-label + :queue queue + :elapsed (some-> elapsed dt/format-duration) + :params (-> (select-keys params [::rpc/profile-id :file-id :profile-id]) + (set/rename-keys {::rpc/profile-id :profile-id}) + (update-vals str))))) (def ^:private idseq (AtomicLong. 0)) (defn- invoke - [limiter metrics limit-id limit-key limit-label profile-id f params] + [limiter metrics limit-id limit-key limit-label handler params] (let [tpoint (dt/tpoint) mlabels (into-array String [(id->str limit-id)]) limit-id (id->str limit-id limit-key) stats (pbh/get-stats limiter) - id (.incrementAndGet ^AtomicLong idseq)] + req-id (.incrementAndGet ^AtomicLong idseq)] (try - (measure-and-log! metrics mlabels stats id "enqueued" limit-id limit-label profile-id nil) + (measure! metrics mlabels stats nil) + (log! "enqueued" req-id stats limit-id limit-label params nil) (px/invoke! limiter (fn [] (let [elapsed (tpoint) stats (pbh/get-stats limiter)] - (measure-and-log! metrics mlabels stats id "acquired" limit-id limit-label profile-id elapsed) - (mtx/run! metrics - :id :rpc-climit-timing - :val (inst-ms elapsed) - :labels mlabels) - (apply f params)))) + + (measure! metrics mlabels stats elapsed) + (log! "acquired" req-id stats limit-id limit-label params elapsed) + + (handler params)))) (catch ExceptionInfo cause (let [{:keys [type code]} (ex-data cause)] (if (= :bulkhead-error type) (let [elapsed (tpoint)] - (measure-and-log! metrics mlabels stats id "reject" limit-id limit-label profile-id elapsed) + (log! "rejected" req-id stats limit-id limit-label params elapsed) (ex/raise :type :concurrency-limit :code code :hint "concurrency limit reached" @@ -161,7 +172,9 @@ (finally (let [elapsed (tpoint) stats (pbh/get-stats limiter)] - (measure-and-log! metrics mlabels stats id "finished" limit-id limit-label profile-id elapsed)))))) + + (measure! metrics mlabels stats nil) + (log! "finished" req-id stats limit-id limit-label params elapsed)))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; MIDDLEWARE @@ -219,10 +232,8 @@ (let [limit-key (key-fn params) cache-key [limit-id limit-key] limiter (cache/get cache cache-key (partial create-limiter config)) - profile-id (if (= key-fn ::rpc/profile-id) - limit-key - (get params ::rpc/profile-id))] - (invoke limiter metrics limit-id limit-key label profile-id handler [cfg params]))))) + handler (partial handler cfg)] + (invoke limiter metrics limit-id limit-key label handler params))))) (do (l/wrn :hint "no config found for specified queue" :id (id->str limit-id)) @@ -237,15 +248,15 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defn- build-exec-chain - [{:keys [::label ::profile-id ::rpc/climit ::mtx/metrics] :as cfg} f] + [{:keys [::label ::rpc/climit ::mtx/metrics] :as cfg} f] (let [config (get climit ::config) cache (get climit ::cache)] (reduce (fn [handler [limit-id limit-key :as ckey]] (if-let [config (get config limit-id)] - (fn [& params] - (let [limiter (cache/get cache ckey (partial create-limiter config))] - (invoke limiter metrics limit-id limit-key label profile-id handler params))) - + (fn [cfg params] + (let [limiter (cache/get cache ckey (partial create-limiter config)) + handler (partial handler cfg)] + (invoke limiter metrics limit-id limit-key label handler params))) (do (l/wrn :hint "config not found" :label label :id limit-id) f))) @@ -255,9 +266,9 @@ (defn invoke! "Run a function in context of climit. Intended to be used in virtual threads." - [{:keys [::executor] :as cfg} f & params] + [{:keys [::executor] :as cfg} f params] (let [f (if (some? executor) - (fn [& params] (px/await! (px/submit! executor (fn [] (apply f params))))) + (fn [cfg params] (px/await! (px/submit! executor (fn [] (f cfg params))))) f) f (build-exec-chain cfg f)] - (apply f params))) + (f cfg params))) diff --git a/backend/src/app/rpc/commands/media.clj b/backend/src/app/rpc/commands/media.clj index 1bdcd3c502..08232e8990 100644 --- a/backend/src/app/rpc/commands/media.clj +++ b/backend/src/app/rpc/commands/media.clj @@ -243,12 +243,13 @@ ;; NOTE: we use the climit here in a dynamic invocation because we ;; don't want saturate the process-image limit with IO (download ;; of external image) + (-> cfg (assoc ::climit/id [[:process-image/by-profile (:profile-id params)] [:process-image/global]]) - (assoc ::climit/profile-id (:profile-id params)) (assoc ::climit/label "create-file-media-object-from-url") - (climit/invoke! db/run! cfg create-file-media-object params)))) + (climit/invoke! #(db/run! %1 create-file-media-object %2) params)))) + ;; --- Clone File Media object (Upload and create from url) diff --git a/backend/src/app/rpc/commands/profile.clj b/backend/src/app/rpc/commands/profile.clj index ccb6a8b2eb..89a50b6ad3 100644 --- a/backend/src/app/rpc/commands/profile.clj +++ b/backend/src/app/rpc/commands/profile.clj @@ -233,7 +233,7 @@ :file-mtype (:mtype file)}})))) (defn- generate-thumbnail! - [file] + [_ file] (let [input (media/run {:cmd :info :input file}) thumb (media/run {:cmd :profile-thumbnail :format :jpeg @@ -250,15 +250,15 @@ :content-type (:mtype thumb)})) (defn upload-photo - [{:keys [::sto/storage ::wrk/executor] :as cfg} {:keys [file]}] + [{:keys [::sto/storage ::wrk/executor] :as cfg} {:keys [file] :as params}] (let [params (-> cfg - (assoc ::climit/id :process-image/global) + (assoc ::climit/id [[:process-image/by-profile (:profile-id params)] + [:process-image/global]]) (assoc ::climit/label "upload-photo") (assoc ::climit/executor executor) (climit/invoke! generate-thumbnail! file))] (sto/put-object! storage params))) - ;; --- MUTATION: Request Email Change (declare ^:private request-email-change!) From 8c2038e43befe015b85f804520bd2fc14b1b49a5 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 15 Apr 2024 14:09:44 +0200 Subject: [PATCH 8/8] :bug: Fix incorrect name on audit event --- frontend/src/app/main/data/users.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/main/data/users.cljs b/frontend/src/app/main/data/users.cljs index 392c6e055e..8a540317f6 100644 --- a/frontend/src/app/main/data/users.cljs +++ b/frontend/src/app/main/data/users.cljs @@ -163,7 +163,7 @@ (ptk/reify ::logged-in ev/Event (-data [_] - {::ev/name "signing" + {::ev/name "signin" ::ev/type "identify" :email (:email profile) :auth-backend (:auth-backend profile)