@@ -20,6 +20,7 @@ import {IconAdd} from 'sentry/icons';
20
20
import { t } from 'sentry/locale' ;
21
21
import { space } from 'sentry/styles/space' ;
22
22
import type { Member } from 'sentry/types' ;
23
+ import { isActiveSuperuser } from 'sentry/utils/isActiveSuperuser' ;
23
24
24
25
interface Props {
25
26
Footer : ModalRenderProps [ 'Footer' ] ;
@@ -64,8 +65,6 @@ export default function InviteMembersModalView({
64
65
willInvite,
65
66
error,
66
67
} : Props ) {
67
- const disableInputs = sendingInvites || complete ;
68
-
69
68
const inviteEmails = invites . map ( inv => inv . email ) ;
70
69
const hasDuplicateEmails = inviteEmails . length !== new Set ( inviteEmails ) . size ;
71
70
const isValidInvites = invites . length > 0 && ! hasDuplicateEmails ;
@@ -76,18 +75,29 @@ export default function InviteMembersModalView({
76
75
</ Alert >
77
76
) : null ;
78
77
78
+ const userEmails = member ?. user ?. emails ;
79
+ const isVerified = userEmails ? userEmails . some ( element => element . is_verified ) : false ;
80
+
81
+ const isSuperUser = isActiveSuperuser ( ) ;
82
+
83
+ const disableInputs = sendingInvites || complete || ! isVerified || ! isSuperUser ;
84
+
79
85
return (
80
86
< Fragment >
81
87
{ errorAlert }
82
88
< Heading > { t ( 'Invite New Members' ) } </ Heading >
83
- { willInvite ? (
84
- < Subtext > { t ( 'Invite new members by email to join your organization.' ) } </ Subtext >
85
- ) : (
89
+ { ! isVerified && ! isSuperUser ? (
90
+ < Alert type = "warning" showIcon >
91
+ { t ( 'Please verify your email before inviting other users.' ) }
92
+ </ Alert >
93
+ ) : ! willInvite && isVerified && ! isSuperUser ? (
86
94
< Alert type = "warning" showIcon >
87
95
{ t (
88
96
'You can’t invite users directly, but we’ll forward your request to an org owner or manager for approval.'
89
97
) }
90
98
</ Alert >
99
+ ) : (
100
+ < Subtext > { t ( 'Invite new members by email to join your organization.' ) } </ Subtext >
91
101
) }
92
102
93
103
{ headerInfo }
0 commit comments