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

Disallow to view a file with components-v2

This commit is contained in:
Andrés Moya 2022-09-05 15:53:19 +02:00
parent ce7eed5ea0
commit 3a6876eeec
3 changed files with 19 additions and 5 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,12 @@
[app.common.types.shape.interactions :as ctsi]
[app.main.data.comments :as dcm]
[app.main.data.fonts :as df]
[app.main.data.modal :as modal]
[app.main.features :as features]
[app.main.repo :as rp]
[app.main.store :as st]
[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 +120,18 @@
(->> (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]
(let [team-id (-> state :teams keys first)]
(if (and (= (:type err) :restriction)
(= (:code err) :feature-disabled))
(rx/of (modal/show
{:type :alert
:message (tr "errors.components-v2")
:on-accept #(st/emit! (rt/nav ""))}))
(rx/throw err))))))))))
(declare go-to-frame-auto)

View file

@ -27,8 +27,9 @@
([router id] (resolve router id {} {}))
([router id path-params] (resolve router id path-params {}))
([router id path-params query-params]
(when-let [match (r/match-by-name router id path-params)]
(r/match->path match query-params))))
(if-let [match (r/match-by-name router id path-params)]
(r/match->path match query-params)
"")))
(defn create
[routes]