0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-13 18:48:37 -05:00

Merge pull request #2228 from penpot/hiru-check-v2-viewer

 Disallow to view a file with components-v2
This commit is contained in:
Andrey Antukh 2022-09-05 19:09:01 +02:00 committed by GitHub
commit 45adc8a61d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View file

@ -45,6 +45,7 @@
(s/def ::file-id ::us/uuid)
(s/def ::profile-id ::us/uuid)
(s/def ::share-id ::us/uuid)
(s/def ::components-v2 ::us/boolean)
(s/def ::view-only-bundle
(s/keys :req-un [::file-id] :opt-un [::profile-id ::share-id ::components-v2]))

View file

@ -15,9 +15,11 @@
[app.common.types.shape.interactions :as ctsi]
[app.main.data.comments :as dcm]
[app.main.data.fonts :as df]
[app.main.data.messages :as msg]
[app.main.features :as features]
[app.main.repo :as rp]
[app.util.globals :as ug]
[app.util.i18n :as i18n :refer [tr]]
[app.util.router :as rt]
[beicon.core :as rx]
[cljs.spec.alpha :as s]
@ -117,9 +119,14 @@
(->> (rp/query! :view-only-bundle params')
(rx/mapcat
(fn [{:keys [fonts] :as bundle}]
(rx/of (df/fonts-fetched fonts)
(bundle-fetched (merge bundle params))))))))))
(fn [{:keys [fonts] :as bundle}]
(->> (rx/of (df/fonts-fetched fonts)
(bundle-fetched (merge bundle params))))))
(rx/catch (fn [err]
(if (and (= (:type err) :restriction)
(= (:code err) :feature-disabled))
(rx/of (msg/error (tr "errors.components-v2") {:timeout nil}))
(rx/throw err)))))))))
(declare go-to-frame-auto)