From 347276fb4e12ff6752c6b2285fac69f61cc36d83 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 10 Apr 2024 15:26:33 +0200 Subject: [PATCH] :bug: Fix incorrect team features handling on onboarding team creation --- backend/src/app/rpc/commands/teams.clj | 7 ++++++- frontend/src/app/main/data/dashboard.cljs | 10 +++++----- frontend/src/app/main/ui/onboarding/team_choice.cljs | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/backend/src/app/rpc/commands/teams.clj b/backend/src/app/rpc/commands/teams.clj index f62f8bc6a..7a21a1241 100644 --- a/backend/src/app/rpc/commands/teams.clj +++ b/backend/src/app/rpc/commands/teams.clj @@ -869,7 +869,12 @@ ::sm/params schema:create-team-with-invitations} [{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id emails role] :as params}] (db/with-atomic [conn pool] - (let [params (assoc params :profile-id profile-id) + + (let [features (-> (cfeat/get-enabled-features cf/flags) + (cfeat/check-client-features! (:features params))) + params (assoc params + :profile-id profile-id + :features features) cfg (assoc cfg ::db/conn conn) team (create-team cfg params) profile (db/get-by-id conn :profile profile-id) diff --git a/frontend/src/app/main/data/dashboard.cljs b/frontend/src/app/main/data/dashboard.cljs index bde91339d..267e299e2 100644 --- a/frontend/src/app/main/data/dashboard.cljs +++ b/frontend/src/app/main/data/dashboard.cljs @@ -425,11 +425,11 @@ (let [{:keys [on-success on-error] :or {on-success identity on-error rx/throw}} (meta params) - features (features/get-enabled-features state)] - params {:name name - :emails #{emails} - :role role - :features features} + features (features/get-enabled-features state) + params {:name name + :emails emails + :role role + :features features}] (->> (rp/cmd! :create-team-with-invitations params) (rx/tap on-success) (rx/map team-created) diff --git a/frontend/src/app/main/ui/onboarding/team_choice.cljs b/frontend/src/app/main/ui/onboarding/team_choice.cljs index a3a007c38..86b710bcf 100644 --- a/frontend/src/app/main/ui/onboarding/team_choice.cljs +++ b/frontend/src/app/main/ui/onboarding/team_choice.cljs @@ -154,7 +154,7 @@ params (:clean-data @form) emails (:emails params) - roles (mf/use-memo #(get-available-roles)) + roles (mf/use-memo get-available-roles) on-success (mf/use-fn @@ -168,7 +168,7 @@ on-error (mf/use-fn - (fn [_form _response] + (fn [_form _cause] (st/emit! (msg/error "Error on creating team.")))) ;; The SKIP branch only creates the team, without invitations