0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 15:39:50 -05:00

🐛 Add missing fragment persistence on creating file

Related with storage/pointer-map feature.
This commit is contained in:
Andrey Antukh 2023-03-16 19:41:30 +01:00
parent 938890c04c
commit f18d2ea629

View file

@ -33,22 +33,26 @@
(db/insert! conn :file-profile-rel)))) (db/insert! conn :file-profile-rel))))
(defn create-file (defn create-file
[conn {:keys [id name project-id is-shared data revn [conn {:keys [id name project-id is-shared revn
modified-at deleted-at create-page modified-at deleted-at create-page
ignore-sync-until features] ignore-sync-until features]
:or {is-shared false revn 0 create-page true} :or {is-shared false revn 0 create-page true}
:as params}] :as params}]
(let [id (or id (:id data) (uuid/next))
(db/exec-one! conn ["SET CONSTRAINTS ALL DEFERRED;"])
(let [id (or id (uuid/next))
features (-> (into files/default-features features) features (-> (into files/default-features features)
(files/check-features-compatibility!)) (files/check-features-compatibility!))
data (or data data (binding [pmap/*tracked* (atom {})
(binding [ffeat/*current* features ffeat/*current* features
ffeat/*wrap-with-objects-map-fn* (if (features "storate/objects-map") omap/wrap identity) ffeat/*wrap-with-objects-map-fn* (if (features "storate/objects-map") omap/wrap identity)
ffeat/*wrap-with-pointer-map-fn* (if (features "storage/pointer-map") pmap/wrap identity)] ffeat/*wrap-with-pointer-map-fn* (if (features "storage/pointer-map") pmap/wrap identity)]
(if create-page (let [data (if create-page
(ctf/make-file-data id) (ctf/make-file-data id)
(ctf/make-file-data id nil)))) (ctf/make-file-data id nil))]
(files/persist-pointers! conn id)
data))
features (db/create-array conn "text" features) features (db/create-array conn "text" features)
file (db/insert! conn :file file (db/insert! conn :file