mirror of
https://github.com/penpot/penpot.git
synced 2025-06-01 06:31:39 +02:00
💄 Add cosmetic change to create-temp-file rpc method
This commit is contained in:
parent
534659cdc6
commit
23f7889cff
1 changed files with 28 additions and 27 deletions
|
@ -45,37 +45,38 @@
|
||||||
(sv/defmethod ::create-temp-file
|
(sv/defmethod ::create-temp-file
|
||||||
{::doc/added "1.17"
|
{::doc/added "1.17"
|
||||||
::doc/module :files
|
::doc/module :files
|
||||||
::sm/params schema:create-temp-file}
|
::sm/params schema:create-temp-file
|
||||||
[cfg {:keys [::rpc/profile-id project-id] :as params}]
|
::db/transaction true}
|
||||||
(db/tx-run! cfg (fn [{:keys [::db/conn] :as cfg}]
|
[{:keys [::db/conn] :as cfg} {:keys [::rpc/profile-id project-id] :as params}]
|
||||||
(projects/check-edition-permissions! conn profile-id project-id)
|
(projects/check-edition-permissions! conn profile-id project-id)
|
||||||
(let [team (teams/get-team conn :profile-id profile-id :project-id project-id)
|
(let [team (teams/get-team conn :profile-id profile-id :project-id project-id)
|
||||||
|
;; When we create files, we only need to respect the team
|
||||||
|
;; features, because some features can be enabled
|
||||||
|
;; globally, but the team is still not migrated properly.
|
||||||
|
input-features
|
||||||
|
(:features params #{})
|
||||||
|
|
||||||
;; When we create files, we only need to respect the team
|
;; If the imported project doesn't contain v2 we need to remove it
|
||||||
;; features, because some features can be enabled
|
team-features
|
||||||
;; globally, but the team is still not migrated properly.
|
(cond-> (cfeat/get-team-enabled-features cf/flags team)
|
||||||
input-features (:features params #{})
|
(not (contains? input-features "components/v2"))
|
||||||
|
(disj "components/v2"))
|
||||||
|
|
||||||
;; If the imported project doesn't contain v2 we need to remove it
|
;; We also include all no migration features declared by
|
||||||
team-features
|
;; client; that enables the ability to enable a runtime
|
||||||
(cond-> (cfeat/get-team-enabled-features cf/flags team)
|
;; feature on frontend and make it permanent on file
|
||||||
(not (contains? input-features "components/v2"))
|
features
|
||||||
(disj "components/v2"))
|
(-> input-features
|
||||||
|
(set/intersection cfeat/no-migration-features)
|
||||||
|
(set/union team-features))
|
||||||
|
|
||||||
|
params
|
||||||
|
(-> params
|
||||||
|
(assoc :profile-id profile-id)
|
||||||
|
(assoc :deleted-at (dt/in-future {:days 1}))
|
||||||
|
(assoc :features features))]
|
||||||
|
|
||||||
;; We also include all no migration features declared by
|
(files.create/create-file cfg params)))
|
||||||
;; client; that enables the ability to enable a runtime
|
|
||||||
;; feature on frontend and make it permanent on file
|
|
||||||
features (-> input-features
|
|
||||||
(set/intersection cfeat/no-migration-features)
|
|
||||||
(set/union team-features))
|
|
||||||
|
|
||||||
params (-> params
|
|
||||||
(assoc :profile-id profile-id)
|
|
||||||
(assoc :deleted-at (dt/in-future {:days 1}))
|
|
||||||
(assoc :features features))]
|
|
||||||
|
|
||||||
(files.create/create-file cfg params)))))
|
|
||||||
|
|
||||||
;; --- MUTATION COMMAND: update-temp-file
|
;; --- MUTATION COMMAND: update-temp-file
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue