0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-13 10:38:13 -05:00

🐛 Fixed issue with shared token for logged users

This commit is contained in:
alonso.torres 2020-12-07 08:55:54 +01:00 committed by Alonso Torres
parent 489dc521e3
commit 1b5efa6ba2
4 changed files with 7 additions and 7 deletions

View file

@ -65,7 +65,7 @@
(assoc bundle :token token))
(let [stoken (retrieve-shared-token conn file-id page-id)]
(files/check-read-permissions! conn profile-id file-id)
(assoc bundle :share-token (:token stoken)))))))
(assoc bundle :token (:token stoken)))))))
(defn check-shared-token!
[conn file-id page-id token]

View file

@ -43,7 +43,7 @@
(t/is (nil? (:error out)))
(let [result (:result out)]
(t/is (contains? result :share-token))
(t/is (contains? result :token))
(t/is (contains? result :page))
(t/is (contains? result :file))
(t/is (contains? result :project)))))

View file

@ -138,7 +138,7 @@
(d/index-by :id)
(assoc state :comment-threads)))
(on-error [err]
(if (= :authorization (:type err))
(if (= :not-authorized (:code err))
(rx/empty)
(rx/throw err)))]
@ -180,7 +180,7 @@
(->> (rp/mutation! :create-file-share-token {:file-id file-id
:page-id page-id})
(rx/map (fn [{:keys [token]}]
#(assoc-in % [:viewer-data :share-token] token))))))))
#(assoc-in % [:viewer-data :token] token))))))))
(defn delete-share-link
[]
@ -189,12 +189,12 @@
(watch [_ state stream]
(let [file-id (:current-file-id state)
page-id (:current-page-id state)
token (get-in state [:viewer-data :share-token])
token (get-in state [:viewer-data :token])
params {:file-id file-id
:page-id page-id
:token token}]
(->> (rp/mutation :delete-file-share-token params)
(rx/map (fn [_] #(update % :viewer-data dissoc :share-token))))))))
(rx/map (fn [_] #(update % :viewer-data dissoc :token))))))))
;; --- Zoom Management

View file

@ -257,7 +257,7 @@
nil)
(when-not anonymous?
[:& share-link {:token (:share-token data)
[:& share-link {:token (:token data)
:page (:page data)}])
(when-not anonymous?