mirror of
https://github.com/penpot/penpot.git
synced 2025-02-15 11:38:24 -05:00
🐛 Fixed issue with shared token for logged users
This commit is contained in:
parent
489dc521e3
commit
1b5efa6ba2
4 changed files with 7 additions and 7 deletions
|
@ -65,7 +65,7 @@
|
||||||
(assoc bundle :token token))
|
(assoc bundle :token token))
|
||||||
(let [stoken (retrieve-shared-token conn file-id page-id)]
|
(let [stoken (retrieve-shared-token conn file-id page-id)]
|
||||||
(files/check-read-permissions! conn profile-id file-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!
|
(defn check-shared-token!
|
||||||
[conn file-id page-id token]
|
[conn file-id page-id token]
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
(t/is (nil? (:error out)))
|
(t/is (nil? (:error out)))
|
||||||
|
|
||||||
(let [result (:result 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 :page))
|
||||||
(t/is (contains? result :file))
|
(t/is (contains? result :file))
|
||||||
(t/is (contains? result :project)))))
|
(t/is (contains? result :project)))))
|
||||||
|
|
|
@ -138,7 +138,7 @@
|
||||||
(d/index-by :id)
|
(d/index-by :id)
|
||||||
(assoc state :comment-threads)))
|
(assoc state :comment-threads)))
|
||||||
(on-error [err]
|
(on-error [err]
|
||||||
(if (= :authorization (:type err))
|
(if (= :not-authorized (:code err))
|
||||||
(rx/empty)
|
(rx/empty)
|
||||||
(rx/throw err)))]
|
(rx/throw err)))]
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@
|
||||||
(->> (rp/mutation! :create-file-share-token {:file-id file-id
|
(->> (rp/mutation! :create-file-share-token {:file-id file-id
|
||||||
:page-id page-id})
|
:page-id page-id})
|
||||||
(rx/map (fn [{:keys [token]}]
|
(rx/map (fn [{:keys [token]}]
|
||||||
#(assoc-in % [:viewer-data :share-token] token))))))))
|
#(assoc-in % [:viewer-data :token] token))))))))
|
||||||
|
|
||||||
(defn delete-share-link
|
(defn delete-share-link
|
||||||
[]
|
[]
|
||||||
|
@ -189,12 +189,12 @@
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(let [file-id (:current-file-id state)
|
(let [file-id (:current-file-id state)
|
||||||
page-id (:current-page-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
|
params {:file-id file-id
|
||||||
:page-id page-id
|
:page-id page-id
|
||||||
:token token}]
|
:token token}]
|
||||||
(->> (rp/mutation :delete-file-share-token params)
|
(->> (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
|
;; --- Zoom Management
|
||||||
|
|
||||||
|
|
|
@ -257,7 +257,7 @@
|
||||||
nil)
|
nil)
|
||||||
|
|
||||||
(when-not anonymous?
|
(when-not anonymous?
|
||||||
[:& share-link {:token (:share-token data)
|
[:& share-link {:token (:token data)
|
||||||
:page (:page data)}])
|
:page (:page data)}])
|
||||||
|
|
||||||
(when-not anonymous?
|
(when-not anonymous?
|
||||||
|
|
Loading…
Add table
Reference in a new issue