mirror of
https://github.com/penpot/penpot.git
synced 2025-03-13 00:01:51 -05:00
✨ Minor naming change on page query parameters.
This commit is contained in:
parent
d1e4f0de3e
commit
1b3b3b0ee6
2 changed files with 25 additions and 19 deletions
|
@ -253,8 +253,30 @@
|
||||||
(update :data assoc :pages-index {page-id page})
|
(update :data assoc :pages-index {page-id page})
|
||||||
(assoc :pages [page-id]))))
|
(assoc :pages [page-id]))))
|
||||||
|
|
||||||
(defn remove-thumbnails-frames
|
(declare strip-frames-with-thumbnails)
|
||||||
"Removes from data the children for frames that have a thumbnail set up"
|
|
||||||
|
(s/def ::strip-frames-with-thumbnails ::us/boolean)
|
||||||
|
|
||||||
|
(s/def ::page
|
||||||
|
(s/keys :req-un [::profile-id ::file-id]
|
||||||
|
:opt-un [::strip-frames-with-thumbnails]))
|
||||||
|
|
||||||
|
(sv/defmethod ::page
|
||||||
|
"Retrieves the first page of the file. Used mainly for render
|
||||||
|
thumbnails on dashboard."
|
||||||
|
[{:keys [pool] :as cfg} {:keys [profile-id file-id] :as props}]
|
||||||
|
(db/with-atomic [conn pool]
|
||||||
|
(check-read-permissions! conn profile-id file-id)
|
||||||
|
|
||||||
|
(let [cfg (assoc cfg :conn conn)
|
||||||
|
file (retrieve-file cfg file-id)
|
||||||
|
page-id (get-in file [:data :pages 0])]
|
||||||
|
(cond-> (get-in file [:data :pages-index page-id])
|
||||||
|
(true? (:strip-frames-with-thumbnails props))
|
||||||
|
(strip-frames-with-thumbnails)))))
|
||||||
|
|
||||||
|
(defn strip-frames-with-thumbnails
|
||||||
|
"Remove unnecesary shapes from frames that have thumbnail."
|
||||||
[data]
|
[data]
|
||||||
(let [filter-shape?
|
(let [filter-shape?
|
||||||
(fn [objects [id shape]]
|
(fn [objects [id shape]]
|
||||||
|
@ -280,22 +302,6 @@
|
||||||
|
|
||||||
(update data :objects update-objects)))
|
(update data :objects update-objects)))
|
||||||
|
|
||||||
(s/def ::page
|
|
||||||
(s/keys :req-un [::profile-id ::file-id]))
|
|
||||||
|
|
||||||
(sv/defmethod ::page
|
|
||||||
"Retrieves the first page of the file. Used mainly for render
|
|
||||||
thumbnails on dashboard."
|
|
||||||
[{:keys [pool] :as cfg} {:keys [profile-id file-id strip-thumbnails]}]
|
|
||||||
(db/with-atomic [conn pool]
|
|
||||||
(check-read-permissions! conn profile-id file-id)
|
|
||||||
|
|
||||||
(let [cfg (assoc cfg :conn conn)
|
|
||||||
file (retrieve-file cfg file-id)
|
|
||||||
page-id (get-in file [:data :pages 0])]
|
|
||||||
(cond-> (get-in file [:data :pages-index page-id])
|
|
||||||
strip-thumbnails
|
|
||||||
(remove-thumbnails-frames)))))
|
|
||||||
|
|
||||||
;; --- Query: Shared Library Files
|
;; --- Query: Shared Library Files
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
(let [uri (u/join (cfg/get-public-uri) "api/rpc/query/page")
|
(let [uri (u/join (cfg/get-public-uri) "api/rpc/query/page")
|
||||||
params {:file-id file-id
|
params {:file-id file-id
|
||||||
:id page-id
|
:id page-id
|
||||||
:strip-thumbnails true}]
|
:strip-frames-with-thumbnails true}]
|
||||||
(->> (http/send!
|
(->> (http/send!
|
||||||
{:method :get
|
{:method :get
|
||||||
:uri uri
|
:uri uri
|
||||||
|
|
Loading…
Add table
Reference in a new issue