0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

🐛 Fix unauthorized error on handoff on share-link.

This commit is contained in:
Andrey Antukh 2020-11-30 10:51:44 +01:00 committed by Hirunatan
parent 39db88c533
commit 4a7b5618ff
3 changed files with 28 additions and 21 deletions

View file

@ -331,6 +331,22 @@
(when index
(rx/of (go-to-frame-by-index index)))))))
(defn go-to-section
[section]
(ptk/reify ::go-to-section
ptk/WatchEvent
(watch [_ state stream]
(let [route (:route state)
screen (-> route :data :name keyword)
pparams (:path-params route)
qparams (:query-params route)]
(rx/of
(if (= :handoff section)
(rt/nav :handoff pparams qparams)
(rt/nav :viewer pparams (assoc qparams :section section))))))))
(defn set-current-frame [frame-id]
(ptk/reify ::current-frame
ptk/UpdateEvent

View file

@ -161,10 +161,13 @@
:handoff
(let [file-id (get-in route [:path-params :file-id])
page-id (get-in route [:path-params :page-id])
index (get-in route [:query-params :index])]
index (get-in route [:query-params :index])
token (get-in route [:query-params :token])]
[:& handoff {:page-id page-id
:file-id file-id
:index index}])
:index index
:token token}])
:render-object
(do

View file

@ -213,20 +213,7 @@
(mf/use-callback
(mf/deps file-id page-id)
(fn [section]
(st/emit!
(case section
:interactions
(rt/nav :viewer
{:file-id file-id :page-id page-id}
{:index index :section "interactions"})
:comments
(rt/nav :viewer
{:file-id file-id :page-id page-id}
{:index index :section "comments"})
:handoff
(rt/nav :handoff
{:file-id file-id :page-id page-id}
{:index index})))))]
(st/emit! (dv/go-to-section section))))]
[:header.viewer-header
[:div.main-icon
@ -249,11 +236,12 @@
:alt "View mode"}
i/play]
[:button.mode-zone-button.tooltip.tooltip-bottom
{:on-click #(navigate :comments)
:class (dom/classnames :active (= section :comments))
:alt "Comments"}
i/chat]
(when-not anonymous?
[:button.mode-zone-button.tooltip.tooltip-bottom
{:on-click #(navigate :comments)
:class (dom/classnames :active (= section :comments))
:alt "Comments"}
i/chat])
[:button.mode-zone-button.tooltip.tooltip-bottom
{:on-click #(navigate :handoff)