Skip to content

Commit

Permalink
Only show the channel unlink option if you have the right permissions (
Browse files Browse the repository at this point in the history
…mattermost-community#3430)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
  • Loading branch information
jespino and mattermod authored Aug 1, 2022
1 parent 04b5536 commit b31f2af
Showing 1 changed file with 34 additions and 20 deletions.
54 changes: 34 additions & 20 deletions webapp/src/components/shareBoard/channelPermissionsRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ import {Channel} from '../../store/channels'
import {Utils} from '../../utils'
import mutator from '../../mutator'
import octoClient from '../../octoClient'
import {Permission} from '../../constants'

import PrivateIcon from '../../widgets/icons/lockOutline'
import PublicIcon from '../../widgets/icons/globe'
import DeleteIcon from '../../widgets/icons/delete'
import CompassIcon from '../../widgets/icons/compassIcon'
import ConfirmationDialogBox from "../confirmationDialogBox"

import BoardPermissionGate from '../permissions/boardPermissionGate'

const ChannelPermissionsRow = (): JSX.Element => {
const intl = useIntl()
const board = useAppSelector(getCurrentBoard)
Expand Down Expand Up @@ -80,26 +83,37 @@ const ChannelPermissionsRow = (): JSX.Element => {
<div className='ml-3'><strong>{linkedChannel.display_name}</strong></div>
</div>
<div>
<MenuWrapper>
<button className='user-item__button'>
<FormattedMessage
id='BoardMember.schemeEditor'
defaultMessage='Editor'
/>
<CompassIcon
icon='chevron-down'
className='CompassIcon'
/>
</button>
<Menu position='left'>
<Menu.Text
id='Unlink'
icon={<DeleteIcon/>}
name={intl.formatMessage({id: 'BoardMember.unlinkChannel', defaultMessage: 'Unlink'})}
onClick={() => setShowUnlinkChannelConfirmation(true)}
/>
</Menu>
</MenuWrapper>
<BoardPermissionGate permissions={[Permission.ManageBoardRoles]}>
<MenuWrapper>
<button className='user-item__button'>
<FormattedMessage
id='BoardMember.schemeEditor'
defaultMessage='Editor'
/>
<CompassIcon
icon='chevron-down'
className='CompassIcon'
/>
</button>
<Menu position='left'>
<Menu.Text
id='Unlink'
icon={<DeleteIcon/>}
name={intl.formatMessage({id: 'BoardMember.unlinkChannel', defaultMessage: 'Unlink'})}
onClick={() => setShowUnlinkChannelConfirmation(true)}
/>
</Menu>
</MenuWrapper>
</BoardPermissionGate>
<BoardPermissionGate
permissions={[Permission.ManageBoardRoles]}
invert={true}
>
<FormattedMessage
id='BoardMember.schemeEditor'
defaultMessage='Editor'
/>
</BoardPermissionGate>
</div>
</div>
)
Expand Down

0 comments on commit b31f2af

Please sign in to comment.