diff --git a/backend/src/app/rpc/commands/files_create.clj b/backend/src/app/rpc/commands/files_create.clj index bcae300d30..8f4b9b428e 100644 --- a/backend/src/app/rpc/commands/files_create.clj +++ b/backend/src/app/rpc/commands/files_create.clj @@ -112,14 +112,15 @@ ;; FIXME: IMPORTANT: this code can have race conditions, because ;; we have no locks for updating team so, creating two files ;; concurrently can lead to lost team features updating - (when-let [features (-> features (set/difference (:features team)) (set/difference cfeat/no-team-inheritable-features) (not-empty))] - (let [features (->> features - (set/union (:features team)) - (db/create-array conn "text"))] + (let [features (-> features + (set/union (:features team)) + (set/difference cfeat/no-team-inheritable-features) + (into-array))] + (db/update! conn :team {:features features} {:id (:id team)} diff --git a/backend/src/app/rpc/commands/files_update.clj b/backend/src/app/rpc/commands/files_update.clj index e499ea2642..95f90e678f 100644 --- a/backend/src/app/rpc/commands/files_update.clj +++ b/backend/src/app/rpc/commands/files_update.clj @@ -160,7 +160,6 @@ tpoint (ct/tpoint)] - (when (not= (:vern params) (:vern file)) (ex/raise :type :validation @@ -183,15 +182,15 @@ (set/difference (:features team)) (set/difference cfeat/no-team-inheritable-features) (not-empty))] - (let [features (->> features - (set/union (:features team)) - (db/create-array conn "text"))] + (let [features (-> features + (set/union (:features team)) + (set/difference cfeat/no-team-inheritable-features) + (into-array))] (db/update! conn :team {:features features} {:id (:id team)} {::db/return-keys false}))) - (mtx/run! metrics {:id :update-file-changes :inc (count changes)}) (binding [l/*context* (some-> (meta params) diff --git a/backend/src/app/rpc/commands/teams.clj b/backend/src/app/rpc/commands/teams.clj index 1c65e8e516..18f1f1b5f5 100644 --- a/backend/src/app/rpc/commands/teams.clj +++ b/backend/src/app/rpc/commands/teams.clj @@ -503,7 +503,7 @@ (let [features (-> (cfeat/get-enabled-features cf/flags) (set/difference cfeat/frontend-only-features) - (cfeat/check-client-features! (:features params))) + (set/difference cfeat/no-team-inheritable-features)) params (-> params (assoc :profile-id profile-id) (assoc :features features)) diff --git a/common/src/app/common/features.cljc b/common/src/app/common/features.cljc index 29f99d24db..ab99a95d69 100644 --- a/common/src/app/common/features.cljc +++ b/common/src/app/common/features.cljc @@ -67,11 +67,6 @@ "design-tokens/v1" "variants/v1"}) -;; A set of features that should not be propagated to team on creating -;; or modifying a file -(def no-team-inheritable-features - #{"fdata/path-data"}) - ;; A set of features which only affects on frontend and can be enabled ;; and disabled freely by the user any time. This features does not ;; persist on file features field but can be permanently enabled on @@ -85,8 +80,14 @@ ;; Features that are mainly backend only or there are a proper ;; fallback when frontend reports no support for it (def backend-only-features - #{"fdata/objects-map" - "fdata/pointer-map"}) + #{"fdata/pointer-map" + "fdata/objects-map"}) + +;; A set of features that should not be propagated to team on creating +;; or modifying a file or creating or modifying a team +(def no-team-inheritable-features + #{"fdata/path-data" + "fdata/shape-data-type"}) ;; This is a set of features that does not require an explicit ;; migration like components/v2 or the migration is not mandatory to @@ -222,8 +223,6 @@ :hint (str/ffmt "enabled feature '%' not present in file (missing migration)" not-supported))) - (check-supported-features! file-features) - ;; Components v1 is deprecated (when-not (contains? file-features "components/v2") (ex/raise :type :restriction