-
Notifications
You must be signed in to change notification settings - Fork 70
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
test max white list (#2491) #4126
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
if (watch.length < 20) | ||
setValue('triggerAndDiscussion.discussionWhitelist', [...discussionWhitelist, member], { | ||
shouldValidate: true, | ||
}) |
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.
For this existing validation has to be used for additional error:
limit max whitelist members to 20 and show validation error "Maximum whitelist size of 20 members is reached." Underneath the field in blue info panel style and disable selector for new additional members
@@ -172,7 +172,8 @@ export const schemaFactory = (api?: ProxyApi) => { | |||
isDiscussionClosed: Yup.boolean(), | |||
discussionWhitelist: Yup.array().when('isDiscussionClosed', { | |||
is: true, | |||
then: Yup.array().required('Field is required'), | |||
then: Yup.array().test(maxContext('The maximum block number is ${20}', 'maxTriggerBlock', false)) |
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.
It may be something like here - @WRadoslaw Please advise.
then: Yup.array().test(maxContext('The maximum block number is ${20}', 'maxTriggerBlock', false)) | |
then: Yup.array().test(maxContext('The whitelist is limited to ${max} members', (value, context) => { | |
if (!value?.length) return true | |
const validationContext = context.options.context as Conditions | |
return (validationContext.maxWhitelistSize ?? BN_ZERO).gten(value.length) | |
}), false)) |
@@ -24,8 +24,12 @@ export const TriggerAndDiscussionStep = () => { | |||
]) | |||
|
|||
const addMemberToWhitelist = (member: Member) => { | |||
setValue('triggerAndDiscussion.discussionWhitelist', [...discussionWhitelist, member], { shouldValidate: true }) | |||
// if (watch.length < 20) |
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.
Can we remove commented code?
@@ -3,13 +3,16 @@ import * as Yup from 'yup' | |||
|
|||
import { Account } from '@/accounts/types' | |||
import { QuestionValueProps } from '@/common/components/EditableInputList/EditableInputList' | |||
import { BN_ZERO } from '@/common/constants' |
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.
Unused imports:
import { BN_ZERO } from '@/common/constants' |
import { Conditions } from '../../../bounty/modals/AddBountyModal/helpers' | ||
|
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.
Unused imports:
import { Conditions } from '../../../bounty/modals/AddBountyModal/helpers' |
@@ -7,6 +7,7 @@ import { Arrow } from '@/common/components/icons' | |||
import { ListItem } from '@/common/components/List' | |||
import { RowGapBlock } from '@/common/components/page/PageContent' | |||
import { ProgressBar } from '@/common/components/Progress' | |||
import { Tooltip, TooltipDefault } from '@/common/components/Tooltip' |
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.
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.
@chrlschwb I do not see any changes fixing the original issue, I only see some code formatting. Is it expected?
255c533
to
57d03ba
Compare
fixes issue #2491