Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement apply, update, and delete feature flag #10189

Merged
Merged
11 changes: 6 additions & 5 deletions codegen.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"contextType": "../graphql#InternalContext",
"mappers": {
"AddFeatureFlagSuccess": "./types/AddFeatureFlagSuccess#AddFeatureFlagSuccessSource",
"ApplyFeatureFlagSuccess": "./types/ApplyFeatureFlagSuccess#ApplyFeatureFlagSuccessSource",
"DeleteFeatureFlagSuccess": "./types/DeleteFeatureFlagSuccess#DeleteFeatureFlagSuccessSource",
"UpdateFeatureFlagSuccess": "./types/UpdateFeatureFlagSuccess#UpdateFeatureFlagSuccessSource",
"ChangeEmailDomainSuccess": "./types/ChangeEmailDomainSuccess#ChangeEmailDomainSuccessSource",
"Company": "./queries/company#CompanySource",
"DraftEnterpriseInvoicePayload": "./types/DraftEnterpriseInvoicePayload#DraftEnterpriseInvoicePayloadSource",
Expand All @@ -34,7 +37,6 @@
"StartTrialSuccess": "./types/StartTrialSuccess#StartTrialSuccessSource",
"StripeFailPaymentPayload": "./mutations/stripeFailPayment#StripeFailPaymentPayloadSource",
"Team": "../../postgres/types/index#Team as TeamDB",
"UpdateOrgFeatureFlagSuccess": "./types/UpdateOrgFeatureFlagSuccess#UpdateOrgFeatureFlagSuccessSource",
"UpgradeToTeamTierSuccess": "./mutations/upgradeToTeamTier#UpgradeToTeamTierSuccessSource",
"User": "../../postgres/types/IUser#default as IUser",
"VerifyDomainSuccess": "./types/VerifyDomainSuccess#VerifyDomainSuccessSource"
Expand Down Expand Up @@ -64,7 +66,6 @@
"AddAgendaItemPayload": "./types/AddAgendaItemPayload#AddAgendaItemPayloadSource",
"UpdateAgendaItemPayload": "./types/UpdateAgendaItemPayload#UpdateAgendaItemPayloadSource",
"TeamMeetingSettings": "../../postgres/types/index#MeetingSettings as TeamMeetingSettingsDB",
"TeamPromptMeetingSettings": "../../postgres/types/index#MeetingSettings as TeamMeetingSettingsDB",
"PokerMeetingSettings": "../../postgres/types/index#PokerMeetingSettings as PokerMeetingSettingsDB",
"RetrospectiveMeetingSettings": "../../postgres/types/index#RetrospectiveMeetingSettings as RetrospectiveMeetingSettingsDB",
"RemovePokerTemplatePayload": "./types/RemovePokerTemplatePayload#RemovePokerTemplatePayloadSource",
Expand Down Expand Up @@ -122,8 +123,8 @@
"MeetingSeries": "../../postgres/types/MeetingSeries#MeetingSeries",
"MeetingTemplate": "../../database/types/MeetingTemplate#default",
"NewMeeting": "../../postgres/types/Meeting#AnyMeeting",
"NewMeetingStage": "./types/NewMeetingStage#NewMeetingStageSource",
"NewMeetingPhase": "./types/NewMeetingPhase#NewMeetingPhaseSource",
"NewMeetingStage": "./types/NewMeetingStage#NewMeetingStageSource",
"NotificationMeetingStageTimeLimitEnd": "../../database/types/NotificationMeetingStageTimeLimitEnd#default as NotificationMeetingStageTimeLimitEndDB",
"NotificationTeamInvitation": "../../database/types/NotificationTeamInvitation#default as NotificationTeamInvitationDB",
"NotifyDiscussionMentioned": "../../database/types/NotificationDiscussionMentioned#default as NotificationDiscussionMentionedDB",
Expand Down Expand Up @@ -179,12 +180,13 @@
"TeamHealthStage": "./types/TeamHealthStage#TeamHealthStageSource",
"TeamInvitation": "../../database/types/TeamInvitation#default",
"TeamMember": "../../postgres/types/index#TeamMember as TeamMember",
"TeamMemberIntegrationAuthWebhook": "../../postgres/queries/getTeamMemberIntegrationAuth#TeamMemberIntegrationAuth",
"TeamMemberIntegrationAuthOAuth1": "../../postgres/queries/getTeamMemberIntegrationAuth#TeamMemberIntegrationAuth",
"TeamMemberIntegrationAuthOAuth2": "../../postgres/queries/getTeamMemberIntegrationAuth#TeamMemberIntegrationAuth",
"TeamMemberIntegrationAuthWebhook": "../../postgres/queries/getTeamMemberIntegrationAuth#TeamMemberIntegrationAuth",
"TeamMemberIntegrations": "./types/TeamMemberIntegrations#TeamMemberIntegrationsSource",
"TeamPromptMeeting": "../../database/types/MeetingTeamPrompt#default as MeetingTeamPromptDB",
"TeamPromptMeetingMember": "../../database/types/TeamPromptMeetingMember#default as TeamPromptMeetingMemberDB",
"TeamPromptMeetingSettings": "../../postgres/types/index#MeetingSettings as TeamMeetingSettingsDB",
"TeamPromptResponse": "../../postgres/types/index#TeamPromptResponse as TeamPromptResponseDB",
"TemplateDimension": "../../postgres/types/index#TemplateDimension as TemplateDimensionDB",
"TimelineEventTeamPromptComplete": "./types/TimelineEventTeamPromptComplete#TimelineEventTeamPromptCompleteSource",
Expand All @@ -194,7 +196,6 @@
"UpdateAutoJoinSuccess": "./types/UpdateAutoJoinSuccess#UpdateAutoJoinSuccessSource",
"UpdateCreditCardSuccess": "./types/UpdateCreditCardSuccess#UpdateCreditCardSuccessSource",
"UpdateDimensionFieldSuccess": "./types/UpdateDimensionFieldSuccess#UpdateDimensionFieldSuccessSource",
"UpdateFeatureFlagPayload": "./types/UpdateFeatureFlagPayload#UpdateFeatureFlagPayloadSource",
"UpdateGitLabDimensionFieldSuccess": "./types/UpdateGitLabDimensionFieldSuccess#UpdateGitLabDimensionFieldSuccessSource",
"UpdateMeetingPromptSuccess": "./types/UpdateMeetingPromptSuccess#UpdateMeetingPromptSuccessSource",
"UpdateMeetingTemplateSuccess": "./types/UpdateMeetingTemplateSuccess#UpdateMeetingTemplateSuccessSource",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ const query = graphql`
}
}
organizations {
featureFlags {
aiTemplate
}
hasAITemplateFlag: featureFlag(featureName: "aiTemplate")
}
}
}
Expand Down Expand Up @@ -229,7 +227,7 @@ export const ActivityLibrary = (props: Props) => {
const data = usePreloadedQuery<ActivityLibraryQuery>(query, queryRef)
const {viewer} = data
const {availableTemplates, organizations} = viewer
const hasAITemplateFeatureFlag = !!organizations.find((org) => org.featureFlags.aiTemplate)
const hasAITemplateFeatureFlag = organizations.some((org) => org.hasAITemplateFlag)

const [isSearching, setIsSearching] = React.useState(true)
const [templateSearch, refetchTemplateSearch] = useRefetchableFragment<
Expand Down
9 changes: 3 additions & 6 deletions packages/client/components/DashNavList/DashNavListTeams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ const DashNavListTeams = (props: Props) => {
id
name
tier
featureFlags {
publicTeams
}
hasPublicTeamsFlag: featureFlag(featureName: "publicTeams")
viewerTeams {
...DashNavListTeam @relay(mask: false)
}
Expand All @@ -43,9 +41,8 @@ const DashNavListTeams = (props: Props) => {
organizationRef
)
const [showModal, setShowModal] = useState(false)
const {publicTeams, viewerTeams, featureFlags} = organization
const publicTeamsEnabled = featureFlags?.publicTeams
const publicTeamsCount = publicTeamsEnabled ? publicTeams.length : 0
const {publicTeams, viewerTeams, hasPublicTeamsFlag} = organization
const publicTeamsCount = hasPublicTeamsFlag ? publicTeams.length : 0

const handleClose = () => {
setShowModal(false)
Expand Down
9 changes: 3 additions & 6 deletions packages/client/components/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ const Dashboard = (props: Props) => {
...DashSidebar_viewer
...useNewFeatureSnackbar_viewer
overLimitCopy
featureFlags {
insights
}
hasInsightsFlag: featureFlag(featureName: "insights")
teams {
activeMeetings {
...useSnacksForNewMeetings_meetings
Expand All @@ -119,15 +117,14 @@ const Dashboard = (props: Props) => {
queryRef
)
const {viewer} = data
const {teams, featureFlags} = viewer
const {insights} = featureFlags
const {teams, hasInsightsFlag} = viewer
const activeMeetings = teams.flatMap((team) => team.activeMeetings).filter(Boolean)
const {isOpen, toggle, handleMenuClick} = useSidebar()
const isDesktop = useBreakpoint(Breakpoint.SIDEBAR_LEFT)
const overLimitCopy = viewer?.overLimitCopy
const meetingsDashRef = useRef<HTMLDivElement>(null)
useSnackNag(overLimitCopy)
useUsageSnackNag(insights)
useUsageSnackNag(hasInsightsFlag)
useSnacksForNewMeetings(activeMeetings)
useNewFeatureSnackbar(viewer)

Expand Down
6 changes: 2 additions & 4 deletions packages/client/components/RetroDiscussionThreadHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,12 @@ const RetroDiscussionThreadHeader = (props: Props) => {
const organization = useFragment(
graphql`
fragment RetroDiscussionThreadHeader_organization on Organization {
featureFlags {
zoomTranscription
}
hasZoomFlag: featureFlag(featureName: "zoomTranscription")
}
`,
organizationRef ?? null
)
const hasZoomFlag = organization?.featureFlags.zoomTranscription ?? false
const hasZoomFlag = organization?.hasZoomFlag ?? false

const handleHeaderClick = (header: 'discussion' | 'transcription') => {
if (showTranscription && header === 'transcription') return
Expand Down
7 changes: 2 additions & 5 deletions packages/client/components/RetroGroupPhase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ const RetroGroupPhase = (props: Props) => {
}
organization {
tier
featureFlags {
suggestGroups
}
hasSuggestGroupsFlag: featureFlag(featureName: "suggestGroups")
}
}
`,
Expand All @@ -83,8 +81,7 @@ const RetroGroupPhase = (props: Props) => {
autogroupReflectionGroups,
resetReflectionGroups
} = meeting
const {featureFlags, tier} = organization
const {suggestGroups: hasSuggestGroupsFlag} = featureFlags
const {hasSuggestGroupsFlag, tier} = organization
const {openTooltip, closeTooltip, tooltipPortal, originRef} = useTooltip<HTMLDivElement>(
MenuPosition.UPPER_CENTER
)
Expand Down
9 changes: 3 additions & 6 deletions packages/client/components/StandardHubUserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ const StandardHubUserMenu = (props: Props) => {
graphql`
fragment StandardHubUserMenu_viewer on User {
email
featureFlags {
insights
}
hasInsightsFlag: featureFlag(featureName: "insights")
organizations {
id
billingTier
Expand All @@ -54,8 +52,7 @@ const StandardHubUserMenu = (props: Props) => {
`,
viewerRef
)
const {email, featureFlags, organizations} = viewer
const {insights} = featureFlags
const {email, hasInsightsFlag, organizations} = viewer
const ownedFreeOrgs = organizations.filter((org) => org.billingTier === 'starter')
const showUpgradeCTA = ownedFreeOrgs.length > 0
const routeSuffix = ownedFreeOrgs.length === 1 ? `/${ownedFreeOrgs[0]!.id}` : ''
Expand Down Expand Up @@ -83,7 +80,7 @@ const StandardHubUserMenu = (props: Props) => {
</MenuItemLink>
}
/>
{insights && (
{hasInsightsFlag && (
<MenuItem
label={
<MenuItemLink to={'/usage'}>
Expand Down
11 changes: 4 additions & 7 deletions packages/client/components/TeamPromptMeeting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,14 @@ const TeamPromptMeeting = (props: Props) => {
}
}
organization {
featureFlags {
singleColumnStandups
}
hasSingleColumnStandupsFlag: featureFlag(featureName: "singleColumnStandups")
}
}
`,
meetingRef
)
const {phases, organization} = meeting
const {featureFlags} = organization
const {singleColumnStandups} = featureFlags
const {hasSingleColumnStandupsFlag} = organization
const atmosphere = useAtmosphere()
const {viewerId} = atmosphere

Expand Down Expand Up @@ -183,7 +180,7 @@ const TeamPromptMeeting = (props: Props) => {
<TeamPromptEditablePrompt meetingRef={meeting} />
<ErrorBoundary>
<ResponsesGridContainer>
<ResponsesGrid isSingleColumn={singleColumnStandups}>
<ResponsesGrid isSingleColumn={hasSingleColumnStandupsFlag}>
{transitioningStages.map((transitioningStage) => {
const {child: stage, onTransitionEnd, status} = transitioningStage
const {key, displayIdx} = stage
Expand All @@ -195,7 +192,7 @@ const TeamPromptMeeting = (props: Props) => {
onTransitionEnd={onTransitionEnd}
displayIdx={displayIdx}
stageRef={stage}
isSingleColumn={singleColumnStandups}
isSingleColumn={hasSingleColumnStandupsFlag}
/>
)
})}
Expand Down
3 changes: 0 additions & 3 deletions packages/client/modules/demo/DemoUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ export default class DemoUser {
viewerId: string
createdAt = new Date().toJSON()
email: string
featureFlags = {
azureDevOps: false
}
facilitatorUserId: string
facilitatorName: string
inactive = false
Expand Down
7 changes: 0 additions & 7 deletions packages/client/modules/demo/initDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,6 @@ const initDemoOrg = () => {
activeUserCount: 5,
inactiveUserCount: 0
},
featureFlags: {
zoomTranscription: false,
suggestGroups: false,
teamsLimit: false,
noPromptToJoinOrg: false,
publicTeams: false
},
showConversionModal: false
} as const
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,15 @@ const RetroTopic = (props: Props) => {
fragment RetroTopic_meeting on RetrospectiveMeeting {
id
organization {
featureFlags {
shareSummary
}
hasShareSummaryFlag: featureFlag(featureName: "shareSummary")
}
}
`,
meetingRef
)

const {id: meetingId} = meeting

const hasShareSummaryFeatureFlag = meeting.organization.featureFlags.shareSummary

const hasShareSummaryFlag = meeting.organization.hasShareSummaryFlag
const {reflectionGroup, discussion, id: stageId} = stage
const {commentCount, discussionSummary} = discussion
const {reflections, title, voteCount} = reflectionGroup
Expand Down Expand Up @@ -174,7 +170,7 @@ const RetroTopic = (props: Props) => {
{commentLinkLabel}
</AnchorIfEmail>
</td>
{hasShareSummaryFeatureFlag && (
{hasShareSummaryFlag && (
<td style={{padding: '10px'}}>
<ShareTopic
isEmail={isEmail}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ const WholeMeetingSummary = (props: Props) => {
id
summary
organization {
featureFlags {
standupAISummary
noAISummary
}
hasStandupAISummaryFlag: featureFlag(featureName: "standupAISummary")
hasNoAISummaryFlag: featureFlag(featureName: "noAISummary")
}
... on RetrospectiveMeeting {
reflectionGroups(sortBy: voteCount) {
Expand All @@ -49,14 +47,14 @@ const WholeMeetingSummary = (props: Props) => {
const {summary: wholeMeetingSummary, reflectionGroups, organization} = meeting
const reflections = reflectionGroups?.flatMap((group) => group.reflections) // reflectionCount hasn't been calculated yet so check reflections length
const hasMoreThanOneReflection = reflections?.length && reflections.length > 1
if (!hasMoreThanOneReflection || organization.featureFlags.noAISummary || !hasAI) return null
if (!hasMoreThanOneReflection || organization.hasNoAISummaryFlag || !hasAI) return null
if (!wholeMeetingSummary) return <WholeMeetingSummaryLoading />
return <WholeMeetingSummaryResult meetingRef={meeting} />
} else if (meeting.__typename === 'TeamPromptMeeting') {
const {summary: wholeMeetingSummary, responses, organization} = meeting
if (
!organization.featureFlags.standupAISummary ||
organization.featureFlags.noAISummary ||
!organization.hasStandupAISummaryFlag ||
organization.hasNoAISummaryFlag ||
!hasAI ||
!responses ||
responses.length === 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ const NewCheckInQuestion = (props: Props) => {
}
team {
organization {
featureFlags {
noAISummary
}
hasNoAISummaryFlag: featureFlag(featureName: "noAISummary")
}
}
}
Expand All @@ -103,7 +101,7 @@ const NewCheckInQuestion = (props: Props) => {
localPhase,
facilitatorUserId,
team: {
organization: {featureFlags}
organization: {hasNoAISummaryFlag}
}
} = meeting
const {checkInQuestion} = localPhase
Expand Down Expand Up @@ -228,8 +226,7 @@ const NewCheckInQuestion = (props: Props) => {
}
})
}
const showAiIcebreaker =
!featureFlags.noAISummary && isFacilitating && window.__ACTION__.hasOpenAI
const showAiIcebreaker = !hasNoAISummaryFlag && isFacilitating && window.__ACTION__.hasOpenAI

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ const OrgTeams = (props: Props) => {
fragment OrgTeams_organization on Organization {
id
isOrgAdmin
featureFlags {
publicTeams
}
hasPublicTeamsFlag: featureFlag(featureName: "publicTeams")
allTeams {
id
...OrgTeamsRow_team
Expand All @@ -37,8 +35,7 @@ const OrgTeams = (props: Props) => {
isOpen: isAddTeamDialogOpened
} = useDialogState()

const {allTeams, isOrgAdmin, featureFlags} = organization
const hasPublicTeamsFlag = featureFlags.publicTeams
const {allTeams, isOrgAdmin, hasPublicTeamsFlag} = organization
const showAllTeams = isOrgAdmin || hasPublicTeamsFlag
return (
<div className='max-w-4xl pb-4'>
Expand Down
8 changes: 2 additions & 6 deletions packages/client/mutations/EndRetrospectiveMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ graphql`
groupTitle
}
organization {
featureFlags {
noAISummary
}
hasNoAISummaryFlag: featureFlag(featureName: "noAISummary")
}
reflectionGroups(sortBy: voteCount) {
reflections {
Expand Down Expand Up @@ -129,9 +127,7 @@ export const endRetrospectiveTeamOnNext: OnNextHandler<
const reflections = reflectionGroups.flatMap((group) => group.reflections) // reflectionCount hasn't been calculated yet so check reflections length
const hasMoreThanOneReflection = reflections.length > 1
const hasOpenAISummary =
hasMoreThanOneReflection &&
!organization.featureFlags.noAISummary &&
window.__ACTION__.hasOpenAI
hasMoreThanOneReflection && !organization.hasNoAISummaryFlag && window.__ACTION__.hasOpenAI
const hasTeamHealth = phases.some((phase) => phase.phaseType === 'TEAM_HEALTH')
const pathname = `/new-summary/${meetingId}`
const search = new URLSearchParams()
Expand Down
Loading
Loading