From 122acb3eeee7380aa0cd6a72a3520d5d47d35c74 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Fri, 25 Oct 2024 17:42:21 +0200 Subject: [PATCH] :bug: Fix view role user have menu option for unpublish a library --- .../src/app/main/ui/workspace/main_menu.cljs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/main_menu.cljs b/frontend/src/app/main/ui/workspace/main_menu.cljs index d75c75b57..7fd4cddb5 100644 --- a/frontend/src/app/main/ui/workspace/main_menu.cljs +++ b/frontend/src/app/main/ui/workspace/main_menu.cljs @@ -479,7 +479,7 @@ (mf/defc file-menu* {::mf/props :obj ::mf/private true} - [{:keys [on-close file can-edit]}] + [{:keys [on-close file]}] (let [file-id (:id file) shared? (:is-shared file) @@ -487,6 +487,9 @@ frames (->> (cfh/get-immediate-children objects uuid/zero) (filterv cfh/frame-shape?)) + perms (mf/use-ctx ctx/team-permissions) + can-edit (:can-edit perms) + on-remove-shared (mf/use-fn (mf/deps file-id) @@ -567,11 +570,12 @@ :on-close on-close} (if ^boolean shared? - [:> dropdown-menu-item* {:class (stl/css :submenu-item) - :on-click on-remove-shared - :on-key-down on-remove-shared-key-down - :id "file-menu-remove-shared"} - [:span {:class (stl/css :item-name)} (tr "dashboard.unpublish-shared")]] + (when can-edit + [:> dropdown-menu-item* {:class (stl/css :submenu-item) + :on-click on-remove-shared + :on-key-down on-remove-shared-key-down + :id "file-menu-remove-shared"} + [:span {:class (stl/css :item-name)} (tr "dashboard.unpublish-shared")]]) (when can-edit [:> dropdown-menu-item* {:class (stl/css :submenu-item)