mirror of
https://github.com/penpot/penpot.git
synced 2025-05-15 19:36:41 +02:00
✨ Kick out of a team - Visibility of System Status
This commit is contained in:
parent
226ab7233b
commit
823792339f
11 changed files with 88 additions and 42 deletions
|
@ -693,9 +693,10 @@
|
||||||
(sv/defmethod ::delete-team-member
|
(sv/defmethod ::delete-team-member
|
||||||
{::doc/added "1.17"
|
{::doc/added "1.17"
|
||||||
::sm/params schema:delete-team-member}
|
::sm/params schema:delete-team-member}
|
||||||
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id team-id member-id] :as params}]
|
[{:keys [::db/pool ::mbus/msgbus] :as cfg} {:keys [::rpc/profile-id team-id member-id] :as params}]
|
||||||
(db/with-atomic [conn pool]
|
(db/with-atomic [conn pool]
|
||||||
(let [perms (get-permissions conn profile-id team-id)]
|
(let [team (get-team pool :profile-id profile-id :team-id team-id)
|
||||||
|
perms (get-permissions conn profile-id team-id)]
|
||||||
(when-not (or (:is-owner perms)
|
(when-not (or (:is-owner perms)
|
||||||
(:is-admin perms))
|
(:is-admin perms))
|
||||||
(ex/raise :type :validation
|
(ex/raise :type :validation
|
||||||
|
@ -708,6 +709,13 @@
|
||||||
(db/delete! conn :team-profile-rel {:profile-id member-id
|
(db/delete! conn :team-profile-rel {:profile-id member-id
|
||||||
:team-id team-id})
|
:team-id team-id})
|
||||||
|
|
||||||
|
(mbus/pub! msgbus
|
||||||
|
:topic member-id
|
||||||
|
:message {:type :removed-from-team
|
||||||
|
:subs-id member-id
|
||||||
|
:team-id team-id
|
||||||
|
:team-name (:name team)})
|
||||||
|
|
||||||
nil)))
|
nil)))
|
||||||
|
|
||||||
;; --- Mutation: Update Team Photo
|
;; --- Mutation: Update Team Photo
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
[app.main.repo :as rp]
|
[app.main.repo :as rp]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.util.i18n :refer [tr]]
|
[app.util.i18n :refer [tr]]
|
||||||
|
[app.util.router :as rt]
|
||||||
[beicon.v2.core :as rx]
|
[beicon.v2.core :as rx]
|
||||||
[potok.v2.core :as ptk]))
|
[potok.v2.core :as ptk]))
|
||||||
|
|
||||||
|
@ -217,3 +218,22 @@
|
||||||
|
|
||||||
:else
|
:else
|
||||||
permissions)))))))
|
permissions)))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(defn removed-from-team
|
||||||
|
[{:keys [team-id team-name]}]
|
||||||
|
(dm/assert! (uuid? team-id))
|
||||||
|
(ptk/reify ::removed-from-team
|
||||||
|
ptk/WatchEvent
|
||||||
|
(watch [_ state _]
|
||||||
|
(let [msg (tr "dashboard.removed-from-team" team-name)]
|
||||||
|
|
||||||
|
(rx/concat
|
||||||
|
(rx/of (rt/nav :dashboard-projects {:team-id (get-in state [:profile :default-team-id])}))
|
||||||
|
(->> (rx/of (ntf/info msg))
|
||||||
|
;; Delay so the navigation can finish
|
||||||
|
(rx/delay 250)))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1215,4 +1215,5 @@
|
||||||
(case type
|
(case type
|
||||||
:notification (dc/handle-notification msg)
|
:notification (dc/handle-notification msg)
|
||||||
:team-permissions-change (dc/change-team-permissions (assoc msg :workspace? false))
|
:team-permissions-change (dc/change-team-permissions (assoc msg :workspace? false))
|
||||||
|
:removed-from-team (dc/removed-from-team msg)
|
||||||
nil))
|
nil))
|
|
@ -2106,24 +2106,7 @@
|
||||||
(pcb/mod-page {:background (:color color)}))]
|
(pcb/mod-page {:background (:color color)}))]
|
||||||
(rx/of (dch/commit-changes changes)))))))
|
(rx/of (dch/commit-changes changes)))))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;; Read only
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
(defn set-workspace-read-only
|
|
||||||
[read-only?]
|
|
||||||
(ptk/reify ::set-workspace-read-only
|
|
||||||
ptk/UpdateEvent
|
|
||||||
(update [_ state]
|
|
||||||
(assoc-in state [:workspace-global :read-only?] read-only?))
|
|
||||||
|
|
||||||
ptk/WatchEvent
|
|
||||||
(watch [_ _ _]
|
|
||||||
(if read-only?
|
|
||||||
(rx/of :interrupt
|
|
||||||
(remove-layout-flag :colorpalette)
|
|
||||||
(remove-layout-flag :textpalette))
|
|
||||||
(rx/empty)))))
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Measurements
|
;; Measurements
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
(ns app.main.data.workspace.common
|
(ns app.main.data.workspace.common
|
||||||
(:require
|
(:require
|
||||||
[app.common.logging :as log]
|
[app.common.logging :as log]
|
||||||
|
[app.main.data.workspace.layout :as dwl]
|
||||||
|
[beicon.v2.core :as rx]
|
||||||
[potok.v2.core :as ptk]))
|
[potok.v2.core :as ptk]))
|
||||||
|
|
||||||
;; Change this to :info :debug or :trace to debug this module
|
;; Change this to :info :debug or :trace to debug this module
|
||||||
|
@ -56,3 +58,22 @@
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
(update-in state [:workspace-local :hide-toolbar] not))))
|
(update-in state [:workspace-local :hide-toolbar] not))))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Read only
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defn set-workspace-read-only
|
||||||
|
[read-only?]
|
||||||
|
(ptk/reify ::set-workspace-read-only
|
||||||
|
ptk/UpdateEvent
|
||||||
|
(update [_ state]
|
||||||
|
(assoc-in state [:workspace-global :read-only?] read-only?))
|
||||||
|
|
||||||
|
ptk/WatchEvent
|
||||||
|
(watch [_ _ _]
|
||||||
|
(if read-only?
|
||||||
|
(rx/of :interrupt
|
||||||
|
(dwl/remove-layout-flag :colorpalette)
|
||||||
|
(dwl/remove-layout-flag :textpalette))
|
||||||
|
(rx/empty)))))
|
||||||
|
|
|
@ -12,10 +12,12 @@
|
||||||
[app.common.schema :as sm]
|
[app.common.schema :as sm]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.main.data.changes :as dch]
|
[app.main.data.changes :as dch]
|
||||||
[app.main.data.common :refer [handle-notification change-team-permissions]]
|
[app.main.data.common :as dc]
|
||||||
[app.main.data.websocket :as dws]
|
[app.main.data.websocket :as dws]
|
||||||
|
[app.main.data.workspace.common :as dwc]
|
||||||
[app.main.data.workspace.edition :as dwe]
|
[app.main.data.workspace.edition :as dwe]
|
||||||
[app.main.data.workspace.layout :as dwly]
|
[app.main.data.workspace.layout :as dwly]
|
||||||
|
|
||||||
[app.main.data.workspace.libraries :as dwl]
|
[app.main.data.workspace.libraries :as dwl]
|
||||||
[app.util.globals :refer [global]]
|
[app.util.globals :refer [global]]
|
||||||
[app.util.mouse :as mse]
|
[app.util.mouse :as mse]
|
||||||
|
@ -103,16 +105,15 @@
|
||||||
(let [viewer? (= :viewer role)]
|
(let [viewer? (= :viewer role)]
|
||||||
|
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(->> (rx/of :interrupt
|
(rx/of :interrupt
|
||||||
(dwe/clear-edition-mode))
|
(dwe/clear-edition-mode)
|
||||||
|
(dwc/set-workspace-read-only false))
|
||||||
|
(->> (rx/of (dc/change-team-permissions msg))
|
||||||
;; Delay so anything that launched :interrupt can finish
|
;; Delay so anything that launched :interrupt can finish
|
||||||
(rx/delay 500))
|
(rx/delay 100))
|
||||||
|
|
||||||
(if viewer?
|
(if viewer?
|
||||||
(rx/of (dwly/set-options-mode :design))
|
(rx/of (dwly/set-options-mode :inspect))
|
||||||
(rx/empty))
|
(rx/of (dwly/set-options-mode :design))))))))
|
||||||
|
|
||||||
(rx/of (change-team-permissions msg)))))))
|
|
||||||
|
|
||||||
|
|
||||||
(defn- process-message
|
(defn- process-message
|
||||||
|
@ -125,8 +126,9 @@
|
||||||
:pointer-update (handle-pointer-update msg)
|
:pointer-update (handle-pointer-update msg)
|
||||||
:file-change (handle-file-change msg)
|
:file-change (handle-file-change msg)
|
||||||
:library-change (handle-library-change msg)
|
:library-change (handle-library-change msg)
|
||||||
:notification (handle-notification msg)
|
:notification (dc/handle-notification msg)
|
||||||
:team-permissions-change (handle-change-team-permissions (assoc msg :workspace? true))
|
:team-permissions-change (handle-change-team-permissions (assoc msg :workspace? true))
|
||||||
|
:removed-from-team (dc/removed-from-team msg)
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
(defn- handle-pointer-send
|
(defn- handle-pointer-send
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
[app.common.geom.shapes :as gsh]
|
[app.common.geom.shapes :as gsh]
|
||||||
[app.common.types.shape.layout :as ctl]
|
[app.common.types.shape.layout :as ctl]
|
||||||
[app.main.data.workspace :as udw]
|
[app.main.data.workspace :as udw]
|
||||||
|
[app.main.data.workspace.common :as dwc]
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.context :as ctx]
|
[app.main.ui.context :as ctx]
|
||||||
|
@ -147,8 +148,8 @@
|
||||||
(let [options-mode (keyword options-mode)]
|
(let [options-mode (keyword options-mode)]
|
||||||
(st/emit! (udw/set-options-mode options-mode))
|
(st/emit! (udw/set-options-mode options-mode))
|
||||||
(if (= options-mode :inspect)
|
(if (= options-mode :inspect)
|
||||||
(st/emit! :interrupt (udw/set-workspace-read-only true))
|
(st/emit! :interrupt (dwc/set-workspace-read-only true))
|
||||||
(st/emit! :interrupt (udw/set-workspace-read-only false)))))
|
(st/emit! :interrupt (dwc/set-workspace-read-only false)))))
|
||||||
|
|
||||||
design-content
|
design-content
|
||||||
(mf/html [:& design-menu {:selected selected
|
(mf/html [:& design-menu {:selected selected
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
[app.common.files.helpers :as cfh]
|
[app.common.files.helpers :as cfh]
|
||||||
[app.common.types.shape.layout :as ctl]
|
[app.common.types.shape.layout :as ctl]
|
||||||
[app.main.data.workspace :as dw]
|
[app.main.data.workspace :as dw]
|
||||||
|
[app.main.data.workspace.common :as dwc]
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.context :as ctx]
|
[app.main.ui.context :as ctx]
|
||||||
|
@ -26,7 +27,7 @@
|
||||||
(fn []
|
(fn []
|
||||||
(st/emit! :interrupt
|
(st/emit! :interrupt
|
||||||
(dw/set-options-mode :design)
|
(dw/set-options-mode :design)
|
||||||
(dw/set-workspace-read-only false))))]
|
(dwc/set-workspace-read-only false))))]
|
||||||
[:div {:class (stl/css :viewport-actions)}
|
[:div {:class (stl/css :viewport-actions)}
|
||||||
[:div {:class (stl/css :viewport-actions-container)}
|
[:div {:class (stl/css :viewport-actions-container)}
|
||||||
[:div {:class (stl/css :viewport-actions-title)}
|
[:div {:class (stl/css :viewport-actions-title)}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
[app.main.data.preview :as dp]
|
[app.main.data.preview :as dp]
|
||||||
[app.main.data.viewer.shortcuts]
|
[app.main.data.viewer.shortcuts]
|
||||||
[app.main.data.workspace :as dw]
|
[app.main.data.workspace :as dw]
|
||||||
|
[app.main.data.workspace.common :as dwcm]
|
||||||
[app.main.data.workspace.path.shortcuts]
|
[app.main.data.workspace.path.shortcuts]
|
||||||
[app.main.data.workspace.selection :as dws]
|
[app.main.data.workspace.selection :as dws]
|
||||||
[app.main.data.workspace.shortcuts]
|
[app.main.data.workspace.shortcuts]
|
||||||
|
@ -370,7 +371,7 @@
|
||||||
|
|
||||||
(defn ^:export set-workspace-read-only
|
(defn ^:export set-workspace-read-only
|
||||||
[read-only?]
|
[read-only?]
|
||||||
(st/emit! (dw/set-workspace-read-only read-only?)))
|
(st/emit! (dwcm/set-workspace-read-only read-only?)))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; REPAIR & VALIDATION
|
;; REPAIR & VALIDATION
|
||||||
|
|
|
@ -752,22 +752,26 @@ msgstr "+ New project"
|
||||||
msgid "dashboard.new-project-prefix"
|
msgid "dashboard.new-project-prefix"
|
||||||
msgstr "New Project"
|
msgstr "New Project"
|
||||||
|
|
||||||
#: src/app/main/data/dashboard.cljs:72
|
#: src/app/main/data/common.cljs:72
|
||||||
msgid "dashboard.permissions-change.viewer"
|
msgid "dashboard.permissions-change.viewer"
|
||||||
msgstr "You are now a viewer on this team."
|
msgstr "You are now a viewer on this team."
|
||||||
|
|
||||||
#: src/app/main/data/dashboard.cljs:75
|
#: src/app/main/data/common.cljs:75
|
||||||
msgid "dashboard.permissions-change.editor"
|
msgid "dashboard.permissions-change.editor"
|
||||||
msgstr "You are now an editor on this team."
|
msgstr "You are now an editor on this team."
|
||||||
|
|
||||||
#: src/app/main/data/dashboard.cljs:78
|
#: src/app/main/data/common.cljs:78
|
||||||
msgid "dashboard.permissions-change.admin"
|
msgid "dashboard.permissions-change.admin"
|
||||||
msgstr "You are now an admin on this team."
|
msgstr "You are now an admin on this team."
|
||||||
|
|
||||||
#: src/app/main/data/dashboard.cljs:81
|
#: src/app/main/data/common.cljs:195
|
||||||
msgid "dashboard.permissions-change.owner"
|
msgid "dashboard.permissions-change.owner"
|
||||||
msgstr "You are now owner on this team."
|
msgstr "You are now owner on this team."
|
||||||
|
|
||||||
|
#: src/app/main/data/common.cljs:229
|
||||||
|
msgid "dashboard.removed-from-team"
|
||||||
|
msgstr "You are not part of the team “%s“ anymore."
|
||||||
|
|
||||||
#: src/app/main/ui/dashboard/search.cljs:60
|
#: src/app/main/ui/dashboard/search.cljs:60
|
||||||
msgid "dashboard.no-matches-for"
|
msgid "dashboard.no-matches-for"
|
||||||
msgstr "No matches found for “%s“"
|
msgstr "No matches found for “%s“"
|
||||||
|
|
|
@ -762,22 +762,26 @@ msgstr "+ Nuevo proyecto"
|
||||||
msgid "dashboard.new-project-prefix"
|
msgid "dashboard.new-project-prefix"
|
||||||
msgstr "Nuevo Proyecto"
|
msgstr "Nuevo Proyecto"
|
||||||
|
|
||||||
#: src/app/main/data/dashboard.cljs:72
|
#: src/app/main/data/common.cljs:72
|
||||||
msgid "dashboard.permissions-change.viewer"
|
msgid "dashboard.permissions-change.viewer"
|
||||||
msgstr "Ahora eres lector del equipo."
|
msgstr "Ahora eres lector del equipo."
|
||||||
|
|
||||||
#: src/app/main/data/dashboard.cljs:75
|
#: src/app/main/data/common.cljs:75
|
||||||
msgid "dashboard.permissions-change.editor"
|
msgid "dashboard.permissions-change.editor"
|
||||||
msgstr "Ahora eres editor del equipo."
|
msgstr "Ahora eres editor del equipo."
|
||||||
|
|
||||||
#: src/app/main/data/dashboard.cljs:78
|
#: src/app/main/data/common.cljs:78
|
||||||
msgid "dashboard.permissions-change.admin"
|
msgid "dashboard.permissions-change.admin"
|
||||||
msgstr "Ahora eres administrador del equipo."
|
msgstr "Ahora eres administrador del equipo."
|
||||||
|
|
||||||
#: src/app/main/data/dashboard.cljs:81
|
#: src/app/main/data/common.cljs:81
|
||||||
msgid "dashboard.permissions-change.owner"
|
msgid "dashboard.permissions-change.owner"
|
||||||
msgstr "Ahora eres el dueño del equipo."
|
msgstr "Ahora eres el dueño del equipo."
|
||||||
|
|
||||||
|
#: src/app/main/data/common.cljs:229
|
||||||
|
msgid "dashboard.removed-from-team"
|
||||||
|
msgstr "Ya no eres parte del equipo “%s“."
|
||||||
|
|
||||||
#: src/app/main/ui/dashboard/search.cljs:60
|
#: src/app/main/ui/dashboard/search.cljs:60
|
||||||
msgid "dashboard.no-matches-for"
|
msgid "dashboard.no-matches-for"
|
||||||
msgstr "No se encuentra “%s“"
|
msgstr "No se encuentra “%s“"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue