Skip to content

Commit c01c5fc

Browse files
committed
lints
1 parent 93d1973 commit c01c5fc

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

static/app/components/modals/inviteMembersModal/inviteMembersModalview.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {IconAdd} from 'sentry/icons';
2020
import {t} from 'sentry/locale';
2121
import {space} from 'sentry/styles/space';
2222
import type {Member} from 'sentry/types';
23+
import {isActiveSuperuser} from 'sentry/utils/isActiveSuperuser';
2324

2425
interface Props {
2526
Footer: ModalRenderProps['Footer'];
@@ -64,8 +65,6 @@ export default function InviteMembersModalView({
6465
willInvite,
6566
error,
6667
}: Props) {
67-
const disableInputs = sendingInvites || complete;
68-
6968
const inviteEmails = invites.map(inv => inv.email);
7069
const hasDuplicateEmails = inviteEmails.length !== new Set(inviteEmails).size;
7170
const isValidInvites = invites.length > 0 && !hasDuplicateEmails;
@@ -76,18 +75,29 @@ export default function InviteMembersModalView({
7675
</Alert>
7776
) : null;
7877

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+
7985
return (
8086
<Fragment>
8187
{errorAlert}
8288
<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 ? (
8694
<Alert type="warning" showIcon>
8795
{t(
8896
'You can’t invite users directly, but we’ll forward your request to an org owner or manager for approval.'
8997
)}
9098
</Alert>
99+
) : (
100+
<Subtext>{t('Invite new members by email to join your organization.')}</Subtext>
91101
)}
92102

93103
{headerInfo}

0 commit comments

Comments
 (0)