mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 15:51:43 +00:00
SSC: Three small fixes for Teams & invites (#62818)
* Fix logging mistakes * Fix URL and logging * Make invite count dynamic in notification
This commit is contained in:
parent
4973440f33
commit
1652ed0c17
@ -238,10 +238,11 @@ export const CodySubscriptionPage: React.FunctionComponent<CodySubscriptionPageP
|
||||
</Button>
|
||||
<Link
|
||||
className="text-center"
|
||||
to="https://sourcegraph.com/contact/request-info?utm_source=cody_subscription_page"
|
||||
to={manageSubscriptionRedirectURL}
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
onClick={() => {
|
||||
onClick={event => {
|
||||
event.preventDefault()
|
||||
telemetryRecorder.recordEvent('cody.planSelection', 'click', {
|
||||
metadata: { tier: 1, team: 0 },
|
||||
})
|
||||
|
||||
@ -23,6 +23,7 @@ export const InviteUsers: React.FunctionComponent<InviteUsersProps> = ({
|
||||
const [emailAddressesString, setEmailAddressesString] = useState<string>('')
|
||||
const [emailAddressErrorMessage, setEmailAddressErrorMessage] = useState<string | null>(null)
|
||||
const [invitesSendingStatus, setInvitesSendingStatus] = useState<'idle' | 'sending' | 'success' | 'error'>('idle')
|
||||
const [invitesSentCount, setInvitesSentCount] = useState(0)
|
||||
const [invitesSendingErrorMessage, setInvitesSendingErrorMessage] = useState<string | null>(null)
|
||||
|
||||
const onSendInvitesClicked = useCallback(async () => {
|
||||
@ -58,6 +59,7 @@ export const InviteUsers: React.FunctionComponent<InviteUsersProps> = ({
|
||||
return
|
||||
}
|
||||
setInvitesSendingStatus('success')
|
||||
setInvitesSentCount(emailAddresses.length)
|
||||
telemetryRecorder.recordEvent('cody.team.sendInvites', 'success', {
|
||||
metadata: { count: emailAddresses.length },
|
||||
privateMetadata: { teamId, emailAddresses },
|
||||
@ -76,7 +78,9 @@ export const InviteUsers: React.FunctionComponent<InviteUsersProps> = ({
|
||||
<>
|
||||
{invitesSendingStatus === 'success' && (
|
||||
<div className={classNames('mb-4', styles.alert, styles.blueSuccessAlert)}>
|
||||
<H3>4 invites sent!</H3>
|
||||
<H3>
|
||||
{invitesSentCount} {pluralize('invite', invitesSentCount)} sent!
|
||||
</H3>
|
||||
<Text size="small" className="mb-0">
|
||||
Invitees will receive an email from cody@sourcegraph.com.
|
||||
</Text>
|
||||
|
||||
@ -104,7 +104,7 @@ export const TeamMemberList: FunctionComponent<TeamMemberListProps> = ({
|
||||
if (!loading) {
|
||||
// Avoids sending multiple requests at once
|
||||
setLoading(true)
|
||||
telemetryRecorder.recordEvent('cody.team.revokeInvite', 'click', { privateMetadata: { teamId } })
|
||||
telemetryRecorder.recordEvent('cody.team.resendInvite', 'click', { privateMetadata: { teamId } })
|
||||
|
||||
const response = await requestSSC(`/team/current/invites/${inviteId}/resend`, 'POST')
|
||||
if (!response.ok) {
|
||||
@ -126,11 +126,9 @@ export const TeamMemberList: FunctionComponent<TeamMemberListProps> = ({
|
||||
|
||||
const removeMember = useCallback(
|
||||
async (accountId: string): Promise<void> => {
|
||||
telemetryRecorder.recordEvent('cody.team.removeMember', 'click', { privateMetadata: { teamId, accountId } })
|
||||
|
||||
if (!loading) {
|
||||
setLoading(true)
|
||||
telemetryRecorder.recordEvent('cody.team.revokeInvite', 'click', { privateMetadata: { teamId } })
|
||||
telemetryRecorder.recordEvent('cody.team.removeMember', 'click', { privateMetadata: { teamId } })
|
||||
|
||||
const response = await requestSSC(`/team/current/members/${accountId}`, 'DELETE')
|
||||
if (!response.ok) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user