mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 07:29:08 -05:00
Merge pull request #5189 from penpot/palba-bugs-viewer-role
Issues on viewer role
This commit is contained in:
commit
22800e71df
4 changed files with 50 additions and 43 deletions
|
@ -118,8 +118,11 @@
|
|||
:created-at (:created-at commit)
|
||||
:commit-id commit-id
|
||||
:changes (vec changes)
|
||||
:features features}]
|
||||
:features features}
|
||||
permissions (:permissions state)]
|
||||
|
||||
;; Prevent commit changes by a team member without edition permission
|
||||
(when (:can-edit permissions)
|
||||
(->> (rp/cmd! :update-file params)
|
||||
(rx/mapcat (fn [{:keys [revn lagged] :as response}]
|
||||
(log/debug :hint "changes persisted" :commit-id (dm/str commit-id) :lagged (count lagged))
|
||||
|
@ -133,7 +136,7 @@
|
|||
(rx/of (ptk/data-event ::error cause)
|
||||
(update-status :error)))
|
||||
(rx/of (discard-persistence-state))
|
||||
(rx/throw cause))))))))))
|
||||
(rx/throw cause)))))))))))
|
||||
|
||||
|
||||
(defn- run-persistence-task
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
[app.main.data.workspace.common :as dwc]
|
||||
[app.main.data.workspace.edition :as dwe]
|
||||
[app.main.data.workspace.layout :as dwly]
|
||||
|
||||
[app.main.data.workspace.libraries :as dwl]
|
||||
[app.main.data.workspace.texts :as dwt]
|
||||
[app.util.globals :refer [global]]
|
||||
[app.util.mouse :as mse]
|
||||
[app.util.object :as obj]
|
||||
|
@ -106,7 +106,8 @@
|
|||
(rx/of :interrupt
|
||||
(dwe/clear-edition-mode)
|
||||
(dwc/set-workspace-read-only false))
|
||||
(->> (rx/of (dc/change-team-role msg))
|
||||
(->> (rx/of (dc/change-team-role msg)
|
||||
::dwt/update-editor-state)
|
||||
;; Delay so anything that launched :interrupt can finish
|
||||
(rx/delay 100))
|
||||
(if (= :viewer role)
|
||||
|
|
|
@ -258,6 +258,7 @@
|
|||
(let [member-is-owner (:is-owner member)
|
||||
member-is-admin (and (:is-admin member) (not member-is-owner))
|
||||
member-is-editor (and (:can-edit member) (and (not member-is-admin) (not member-is-owner)))
|
||||
member-is-viewer (and (not member-is-editor) (not member-is-admin) (not member-is-owner))
|
||||
show? (mf/use-state false)
|
||||
|
||||
permissions (:permissions team)
|
||||
|
@ -267,7 +268,7 @@
|
|||
is-you (= (:id profile) (:id member))
|
||||
|
||||
can-change-rol (or is-owner is-admin)
|
||||
not-superior (or is-admin (and can-change-rol (or member-is-admin member-is-editor)))
|
||||
not-superior (or is-admin (and can-change-rol (or member-is-admin member-is-editor member-is-viewer)))
|
||||
|
||||
role (cond
|
||||
member-is-owner "labels.owner"
|
||||
|
@ -288,15 +289,15 @@
|
|||
|
||||
[:& dropdown {:show @show? :on-close on-hide}
|
||||
[:ul {:class (stl/css :roles-dropdown)}
|
||||
[:li {:on-click on-set-admin
|
||||
:class (stl/css :rol-dropdown-item)}
|
||||
(tr "labels.admin")]
|
||||
[:li {:on-click on-set-editor
|
||||
:class (stl/css :rol-dropdown-item)}
|
||||
(tr "labels.editor")]
|
||||
[:li {:on-click on-set-viewer
|
||||
:class (stl/css :rol-dropdown-item)}
|
||||
(tr "labels.viewer")]
|
||||
[:li {:on-click on-set-editor
|
||||
:class (stl/css :rol-dropdown-item)}
|
||||
(tr "labels.editor")]
|
||||
[:li {:on-click on-set-admin
|
||||
:class (stl/css :rol-dropdown-item)}
|
||||
(tr "labels.admin")]
|
||||
(when is-owner
|
||||
[:li {:on-click (partial on-set-owner member)
|
||||
:class (stl/css :rol-dropdown-item)}
|
||||
|
|
|
@ -34,7 +34,9 @@
|
|||
{::mf/wrap [mf/memo]
|
||||
::mf/wrap-props false}
|
||||
[]
|
||||
(let [status (mf/deref ref:persistence-status)]
|
||||
(let [status (mf/deref ref:persistence-status)
|
||||
workspace-read-only? (mf/use-ctx ctx/workspace-read-only?)]
|
||||
(when-not workspace-read-only?
|
||||
[:div {:class (stl/css :persistence-status-widget)}
|
||||
(case status
|
||||
:pending
|
||||
|
@ -57,7 +59,7 @@
|
|||
:title "There was an error saving the data. Please refresh if this persists."}
|
||||
i/status-wrong]
|
||||
|
||||
nil)]))
|
||||
nil)])))
|
||||
|
||||
;; --- Zoom Widget
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue