11// Libraries
22import React , { FC , useContext , useState } from 'react'
3- import { useSelector } from 'react-redux'
43import { capitalize } from 'lodash'
54
65// Components
@@ -16,17 +15,12 @@ import {
1615} from '@influxdata/clockface'
1716import { UsersContext } from 'src/users/context/users'
1817
19- // Selectors
20- import { getMe } from 'src/me/selectors'
21-
2218// Types
2319import { CloudUser } from 'src/types'
2420
25- // Utils
26- import { isFlagEnabled } from 'src/shared/utils/featureFlag'
27-
2821interface Props {
2922 user : CloudUser
23+ isDeletable : boolean
3024}
3125
3226// TODO: add back in once https://github.com/influxdata/quartz/issues/2389 back-filling of names is complete
@@ -47,14 +41,11 @@ interface Props {
4741// return ''
4842// }
4943
50- const UserListItem : FC < Props > = ( { user} ) => {
51- const { id, email, role} = user
52- const currentUserId = useSelector ( getMe ) ?. id
44+ const UserListItem : FC < Props > = ( { user, isDeletable} ) => {
45+ const { email, role} = user
5346 const { handleRemoveUser, removeUserStatus} = useContext ( UsersContext )
5447
55- const isCurrentUser = id === currentUserId
5648 const [ revealOnHover , toggleRevealOnHover ] = useState ( true )
57- const selfRemovalFromAccount = isFlagEnabled ( 'selfRemovalFromAccount' )
5849
5950 const handleShow = ( ) => {
6051 toggleRevealOnHover ( false )
@@ -93,7 +84,7 @@ const UserListItem: FC<Props> = ({user}) => {
9384 </ IndexList . Cell >
9485 < IndexList . Cell className = "user-list-cell-status" > Active</ IndexList . Cell >
9586 < IndexList . Cell revealOnHover = { revealOnHover } alignment = { Alignment . Right } >
96- { ( ! isCurrentUser || selfRemovalFromAccount ) && (
87+ { isDeletable && (
9788 < ConfirmationButton
9889 icon = { IconFont . Trash_New }
9990 onShow = { handleShow }
0 commit comments