Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -83,26 +83,32 @@ export const useColumns = (props: UseColumnsProps): UseColumnsReturn => {
const rowIndex = info.row.index
const rowValue = info.row.original as DisplayManyToManyRelationValueItem

const hasAccess = rowValue.hasAccess !== false
const canEdit = rowValue.canEdit !== false

const buttons: ReactElement[] = []
buttons.push(
<Tooltip
key="open"
title={ t('open') }
>
<IconButton
icon={ { value: 'open-folder' } }
onClick={ async () => {
const typeValue = mapToElementType(rowValue.type)

!isUndefined(typeValue) && await openElement({
type: typeValue,
id: rowValue.id
})
} }
type="link"
/>
</Tooltip>
)

if (hasAccess) {
buttons.push(
<Tooltip
key="open"
title={ t('open') }
>
<IconButton
icon={ { value: 'open-folder' } }
onClick={ async () => {
const typeValue = mapToElementType(rowValue.type)

!isUndefined(typeValue) && await openElement({
type: typeValue,
id: rowValue.id
})
} }
type="link"
/>
</Tooltip>
)
}

if (props.assetInlineDownloadAllowed && rowValue.type === 'asset') {
buttons.push(
Expand All @@ -124,7 +130,7 @@ export const useColumns = (props: UseColumnsProps): UseColumnsReturn => {
)
}

if (props.disabled !== true) {
if (props.disabled !== true && canEdit) {
buttons.push(
<Tooltip
key="remove"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export interface ManyToManyRelationValueItem {
subtype: string | null
fullPath: string
isPublished: boolean | null
hasAccess?: boolean
canEdit?: boolean
}

export interface DisplayManyToManyRelationValueItem extends ManyToManyRelationValueItem {
Expand Down
Loading
Loading