0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 22:49:01 -05:00

🐛 Fix adding an extra blank page on import

This commit is contained in:
Andrés Moya 2022-12-01 11:19:38 +01:00
parent 296b6c646e
commit 148f6cb3c2
5 changed files with 24 additions and 7 deletions

View file

@ -18,6 +18,7 @@
- Fix some texts and a typo [Taiga #4215](https://tree.taiga.io/project/penpot/issue/4215)
- Fix twitter support account link [Taiga #4279](https://tree.taiga.io/project/penpot/issue/4279)
- Fix lang autodetect issue [Taiga #4277](https://tree.taiga.io/project/penpot/issue/4277)
- Fix adding an extra page on import [Taiga #4543](https://tree.taiga.io/project/penpot/task/4543)
### :arrow_up: Deps updates
### :heart: Community contributions by (Thank you!)

View file

@ -31,9 +31,9 @@
(defn create-file
[conn {:keys [id name project-id is-shared data revn
modified-at deleted-at
modified-at deleted-at create-page
ignore-sync-until features]
:or {is-shared false revn 0}
:or {is-shared false revn 0 create-page true}
:as params}]
(let [id (or id (:id data) (uuid/next))
features (-> (into files/default-features features)
@ -43,7 +43,9 @@
(binding [ffeat/*current* features
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)]
(ctf/make-file-data id)))
(if create-page
(ctf/make-file-data id)
(ctf/make-file-data id nil))))
features (db/create-array conn "text" features)
file (db/insert! conn :file

View file

@ -8,6 +8,7 @@
(:require
[app.common.exceptions :as ex]
[app.common.pages :as cp]
[app.common.spec :as us]
[app.common.uuid :as uuid]
[app.db :as db]
[app.rpc.commands.files :as files]
@ -22,7 +23,16 @@
;; --- MUTATION COMMAND: create-temp-file
(s/def ::create-temp-file ::files.create/create-file)
(s/def ::create-page ::us/boolean)
(s/def ::create-temp-file
(s/keys :req-un [::files/profile-id
::files/name
::files/project-id]
:opt-un [::files/id
::files/is-shared
::files/features
::create-page]))
(sv/defmethod ::create-temp-file
{::doc/added "1.17"}

View file

@ -72,10 +72,13 @@
(make-file-data file-id (uuid/next)))
([file-id page-id]
(let [page (ctp/make-empty-page page-id "Page-1")]
(let [page (when (some? page-id)
(ctp/make-empty-page page-id "Page-1"))]
(cond-> (-> empty-file-data
(assoc :id file-id)
(ctpl/add-page page))
(assoc :id file-id))
(some? page-id)
(ctpl/add-page page)
(contains? ffeat/*current* "components/v2")
(assoc-in [:options :components-v2] true)))))

View file

@ -135,6 +135,7 @@
:name (:name context)
:is-shared (:shared context)
:project-id (:project-id context)
:create-page false
:features features})))
(defn link-file-libraries