mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 02:28:18 -05:00
✨ Properly move viewer queries to commands
And change deprecation version on viewer queries
This commit is contained in:
parent
ba2729fa4a
commit
6a699d7f09
5 changed files with 21 additions and 18 deletions
|
@ -344,6 +344,7 @@
|
||||||
'app.rpc.commands.search
|
'app.rpc.commands.search
|
||||||
'app.rpc.commands.teams
|
'app.rpc.commands.teams
|
||||||
'app.rpc.commands.verify-token
|
'app.rpc.commands.verify-token
|
||||||
|
'app.rpc.commands.viewer
|
||||||
'app.rpc.commands.webhooks)
|
'app.rpc.commands.webhooks)
|
||||||
(map (partial process-method cfg))
|
(map (partial process-method cfg))
|
||||||
(into {}))))
|
(into {}))))
|
||||||
|
|
|
@ -84,6 +84,6 @@
|
||||||
::cond/key-fn files/get-file-etag
|
::cond/key-fn files/get-file-etag
|
||||||
::cond/reuse-key? true
|
::cond/reuse-key? true
|
||||||
::doc/added "1.17"}
|
::doc/added "1.17"}
|
||||||
[{:keys [pool]} {:keys [::rpc/profile-id] :as params}]
|
[{:keys [::db/pool]} {:keys [::rpc/profile-id] :as params}]
|
||||||
(with-open [conn (db/open pool)]
|
(with-open [conn (db/open pool)]
|
||||||
(get-view-only-bundle conn (assoc params :profile-id profile-id))))
|
(get-view-only-bundle conn (assoc params :profile-id profile-id))))
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
(sv/defmethod ::view-only-bundle
|
(sv/defmethod ::view-only-bundle
|
||||||
{::rpc/auth false
|
{::rpc/auth false
|
||||||
::doc/added "1.3"
|
::doc/added "1.3"
|
||||||
::doc/deprecated "1.17"}
|
::doc/deprecated "1.18"}
|
||||||
[{:keys [pool] :as cfg} {:keys [features components-v2] :as params}]
|
[{:keys [pool] :as cfg} {:keys [features components-v2] :as params}]
|
||||||
(with-open [conn (db/open pool)]
|
(with-open [conn (db/open pool)]
|
||||||
(let [;; BACKWARD COMPATIBILTY with the components-v2 parameter
|
(let [;; BACKWARD COMPATIBILTY with the components-v2 parameter
|
||||||
|
|
|
@ -129,22 +129,22 @@
|
||||||
(rx/map :content)
|
(rx/map :content)
|
||||||
(rx/map #(vector key %)))))]
|
(rx/map #(vector key %)))))]
|
||||||
|
|
||||||
(->> (rp/query! :view-only-bundle params')
|
(->> (rp/cmd! :get-view-only-bundle params')
|
||||||
(rx/mapcat
|
(rx/mapcat
|
||||||
(fn [bundle]
|
(fn [bundle]
|
||||||
(->> (rx/from (-> bundle :file :data :pages-index seq))
|
(->> (rx/from (-> bundle :file :data :pages-index seq))
|
||||||
(rx/merge-map
|
(rx/merge-map
|
||||||
(fn [[_ page :as kp]]
|
(fn [[_ page :as kp]]
|
||||||
(if (t/pointer? page)
|
(if (t/pointer? page)
|
||||||
(resolve kp)
|
(resolve kp)
|
||||||
(rx/of kp))))
|
(rx/of kp))))
|
||||||
(rx/reduce conj {})
|
(rx/reduce conj {})
|
||||||
(rx/map (fn [pages-index]
|
(rx/map (fn [pages-index]
|
||||||
(update-in bundle [:file :data] assoc :pages-index pages-index))))))
|
(update-in bundle [:file :data] assoc :pages-index pages-index))))))
|
||||||
(rx/mapcat
|
(rx/mapcat
|
||||||
(fn [{:keys [fonts] :as bundle}]
|
(fn [{:keys [fonts] :as bundle}]
|
||||||
(rx/of (df/fonts-fetched fonts)
|
(rx/of (df/fonts-fetched fonts)
|
||||||
(bundle-fetched (merge bundle params))))))))))
|
(bundle-fetched (merge bundle params))))))))))
|
||||||
|
|
||||||
(declare go-to-frame-auto)
|
(declare go-to-frame-auto)
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
[beicon.core :as rx]))
|
[beicon.core :as rx]))
|
||||||
|
|
||||||
(derive :get-all-projects ::query)
|
(derive :get-all-projects ::query)
|
||||||
|
(derive :get-comment-threads ::query)
|
||||||
(derive :get-file ::query)
|
(derive :get-file ::query)
|
||||||
(derive :get-file-fragment ::query)
|
(derive :get-file-fragment ::query)
|
||||||
(derive :get-file-libraries ::query)
|
(derive :get-file-libraries ::query)
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
(derive :get-team-stats ::query)
|
(derive :get-team-stats ::query)
|
||||||
(derive :get-team-users ::query)
|
(derive :get-team-users ::query)
|
||||||
(derive :get-teams ::query)
|
(derive :get-teams ::query)
|
||||||
|
(derive :get-view-only-bundle ::query)
|
||||||
(derive :search-files ::query)
|
(derive :search-files ::query)
|
||||||
|
|
||||||
(defn handle-response
|
(defn handle-response
|
||||||
|
|
Loading…
Add table
Reference in a new issue