Add improved abstraction for team permissions

Relevant changes:
- replace user-viewer? with can-edit removing many double
  negations on the code
- always use team permissions making the permissions access uniform
  around all the code
- expose team permissions to ui tree through ctx/team-permissions
  context
This commit is contained in:
Andrey Antukh 2024-10-18 16:23:24 +02:00 committed by Alonso Torres
parent b3fcbd91e4
commit d6da8afdce
29 changed files with 412 additions and 391 deletions

View file

@ -20,7 +20,7 @@
:current-page-id nil
:workspace-data nil
:workspace-libraries {}
:features/team #{"components/v2"}})
:features-team #{"components/v2"}})
(defn- on-error
[cause]
@ -33,6 +33,7 @@
(let [state (-> initial-state
(assoc :current-file-id (:id file)
:current-page-id (cthf/current-page-id file)
:permissions {:can-edit true}
:workspace-file (dissoc file :data)
:workspace-data (:data file)))
store (ptk/store {:state state :on-error on-error})]