Skip to content

Commit

Permalink
💄 front: remove move context menu entry for shared link pages (and sk…
Browse files Browse the repository at this point in the history
…ip a separator when appropriate) (#484) (#709)

fix #484
  • Loading branch information
ericlinagora authored Oct 25, 2024
2 parents 88eac6b + 870a0b4 commit 1af277d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tdrive/frontend/src/app/views/client/body/drive/context-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,28 @@ export const useOnBuildContextMenu = (
//Add item related menus
const upToDateItem = await DriveApiClient.get(item.company_id, item.id);
const access = upToDateItem.access || 'none';
const hideShareItem = access === 'read' || getPublicLinkToken() || inTrash;
const hideManageAccessItem =
access === 'read'
|| getPublicLinkToken()
|| inTrash
|| !FeatureTogglesService.isActiveFeatureName(FeatureNames.COMPANY_MANAGE_ACCESS);
const newMenuActions = [
{
type: 'menu',
icon: 'share-alt',
text: Languages.t('components.item_context_menu.share'),
hide: access === 'read' || getPublicLinkToken() || inTrash,
hide: hideShareItem,
onClick: () => setPublicLinkModalState({ open: true, id: item.id }),
},
{
type: 'menu',
icon: 'users-alt',
text: Languages.t('components.item_context_menu.manage_access'),
hide:
access === 'read' ||
getPublicLinkToken() ||
inTrash ||
!FeatureTogglesService.isActiveFeatureName(FeatureNames.COMPANY_MANAGE_ACCESS),
hide: hideManageAccessItem,
onClick: () => setAccessModalState({ open: true, id: item.id }),
},
{ type: 'separator', hide: inTrash },
{ type: 'separator', hide: inTrash || (hideShareItem && hideManageAccessItem) },
{
type: 'menu',
icon: 'download-alt',
Expand Down Expand Up @@ -130,7 +132,7 @@ export const useOnBuildContextMenu = (
type: 'menu',
icon: 'folder-question',
text: Languages.t('components.item_context_menu.move'),
hide: access === 'read' || inTrash,
hide: access === 'read' || inTrash || inPublicSharing,
onClick: () =>
setSelectorModalState({
open: true,
Expand Down

0 comments on commit 1af277d

Please sign in to comment.