From 20bdbfb81a3031cbfedaf080e120e1b23897100c Mon Sep 17 00:00:00 2001 From: DanSylvest Date: Thu, 29 May 2025 09:05:43 +0300 Subject: [PATCH] fix(Map): Allow lock systems for members wnd-414 --- .../useContextMenuSystemItems.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/assets/js/hooks/Mapper/components/contexts/ContextMenuSystem/useContextMenuSystemItems.tsx b/assets/js/hooks/Mapper/components/contexts/ContextMenuSystem/useContextMenuSystemItems.tsx index 2058e483..66af65b5 100644 --- a/assets/js/hooks/Mapper/components/contexts/ContextMenuSystem/useContextMenuSystemItems.tsx +++ b/assets/js/hooks/Mapper/components/contexts/ContextMenuSystem/useContextMenuSystemItems.tsx @@ -44,6 +44,7 @@ export const useContextMenuSystemItems = ({ const getLabels = useLabelsMenu(systems, systemId, onSystemLabels, onCustomLabelDialog); const getWaypointMenu = useWaypointMenu(onWaypointSet); const canLockSystem = useMapCheckPermissions([UserPermission.LOCK_SYSTEM]); + const canManageSystem = useMapCheckPermissions([UserPermission.UPDATE_SYSTEM]); const canDeleteSystem = useMapCheckPermissions([UserPermission.DELETE_SYSTEM]); const getUserRoutes = useUserRoute({ userHubs, systemId, onUserHubToggle }); @@ -132,11 +133,20 @@ export const useContextMenuSystemItems = ({ ); }, }, - ...(canLockSystem + ...(system.locked && canLockSystem ? [ { - label: system.locked ? 'Unlock' : 'Lock', - icon: system.locked ? PrimeIcons.LOCK_OPEN : PrimeIcons.LOCK, + label: 'Unlock', + icon: PrimeIcons.LOCK_OPEN, + command: onLockToggle, + }, + ] + : []), + ...(!system.locked && canManageSystem + ? [ + { + label: 'Lock', + icon: PrimeIcons.LOCK, command: onLockToggle, }, ]