From 408ca338e7295184f697c34db361d4aa67a5cdbe Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 27 May 2024 16:05:31 +0200 Subject: [PATCH 1/2] :paperclip: Make public default profile audit props --- backend/src/app/loggers/audit.clj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/src/app/loggers/audit.clj b/backend/src/app/loggers/audit.clj index c0814a9f2e..b9fa191f5b 100644 --- a/backend/src/app/loggers/audit.clj +++ b/backend/src/app/loggers/audit.clj @@ -53,8 +53,7 @@ (assoc (->> sk str/kebab (keyword "penpot")) v))))] (reduce-kv process-param {} params))) -(def ^:private - profile-props +(def profile-props [:id :is-active :is-muted From 121bff4eac0058a697ebd64d9a96da88d1533025 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 27 May 2024 16:05:54 +0200 Subject: [PATCH 2/2] :sparkles: Send only necessary data on profile update --- backend/src/app/rpc/commands/profile.clj | 1 - frontend/src/app/main/data/users.cljs | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/src/app/rpc/commands/profile.clj b/backend/src/app/rpc/commands/profile.clj index ef9d15e939..4064f0dd6f 100644 --- a/backend/src/app/rpc/commands/profile.clj +++ b/backend/src/app/rpc/commands/profile.clj @@ -110,7 +110,6 @@ ::sm/params schema:update-profile ::sm/result schema:profile} [{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id fullname lang theme] :as params}] - (db/with-atomic [conn pool] ;; NOTE: we need to retrieve the profile independently if we use ;; it or not for explicit locking and avoid concurrent updates of diff --git a/frontend/src/app/main/data/users.cljs b/frontend/src/app/main/data/users.cljs index 6c54750835..e49925038b 100644 --- a/frontend/src/app/main/data/users.cljs +++ b/frontend/src/app/main/data/users.cljs @@ -343,9 +343,9 @@ (watch [_ state _] (let [on-success (:on-success opts identity) on-error (:on-error opts rx/throw) - profile (:profile state)] - - (->> (rp/cmd! :update-profile (dissoc profile :props)) + profile (:profile state) + params (select-keys profile [:fullname :lang :theme])] + (->> (rp/cmd! :update-profile params) (rx/tap on-success) (rx/catch on-error))))))