-
Notifications
You must be signed in to change notification settings - Fork 336
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: allow 2 custom templates for every user #9518
Changes from 14 commits
49db174
f296e5f
6bbb592
a5942ee
5ac330e
32a0211
24c87e0
b85fb31
71f4d9a
dbec412
7e3befd
f71105a
ec37ff9
2c99d96
cb0f353
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,16 +53,17 @@ const AddNewPokerTemplate = (props: Props) => { | |
id | ||
user { | ||
id | ||
featureFlags { | ||
noTemplateLimit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that we've removed the template limit, we should remove this flag altogether. I've created an issue: #9523 |
||
} | ||
freeCustomPokerTemplatesRemaining | ||
} | ||
} | ||
} | ||
`, | ||
teamRef | ||
) | ||
const {id: teamId, tier, viewerTeamMember} = team | ||
const {user} = viewerTeamMember || {} | ||
const {freeCustomPokerTemplatesRemaining} = user || {} | ||
|
||
const {onError, onCompleted, submitMutation, submitting, error} = useMutationProps() | ||
const errorTimerId = useRef<undefined | number>() | ||
useEffect(() => { | ||
|
@@ -71,7 +72,8 @@ const AddNewPokerTemplate = (props: Props) => { | |
} | ||
}, []) | ||
const canEditTemplates = | ||
tier !== 'starter' || viewerTeamMember?.user?.featureFlags?.noTemplateLimit | ||
tier !== 'starter' || | ||
(freeCustomPokerTemplatesRemaining && freeCustomPokerTemplatesRemaining > 0) | ||
const addNewTemplate = () => { | ||
if (submitting) return | ||
if (!canEditTemplates) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ import {GraphQLObjectType} from 'graphql' | |
import {GQLContext} from '../graphql' | ||
import PokerTemplate from './PokerTemplate' | ||
import StandardMutationError from './StandardMutationError' | ||
import {getUserId} from '../../utils/authorization' | ||
import User from './User' | ||
|
||
const AddPokerTemplatePayload = new GraphQLObjectType<any, GQLContext>({ | ||
name: 'AddPokerTemplatePayload', | ||
|
@@ -15,6 +17,14 @@ const AddPokerTemplatePayload = new GraphQLObjectType<any, GQLContext>({ | |
if (!templateId) return null | ||
return dataLoader.get('meetingTemplates').load(templateId) | ||
} | ||
}, | ||
user: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll refactor this to the SDL pattern in a follow-up PR. This PR already touches a lot of files, so I didn't want to bloat it further |
||
type: User, | ||
resolve: (_, _args: unknown, {dataLoader, authToken}) => { | ||
const userId = getUserId(authToken) | ||
if (!userId) return null | ||
return dataLoader.get('users').load(userId) | ||
} | ||
} | ||
}) | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created two flags,
freeCustomRetroTemplatesRemaining
andfreeCustomPokerTemplatesRemaining
, thinking of our engineering principle that we should repeat the code twice and, on the third time, refactor it into something reusable.