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

test max white list (#2491) #4126

Closed
wants to merge 0 commits into from

Conversation

chrlschwb
Copy link
Contributor

fixes issue #2491

@vercel
Copy link

vercel bot commented Jan 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dao ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 7, 2023 1:32pm
pioneer-2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 7, 2023 1:32pm
pioneer-2-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 7, 2023 1:32pm

Comment on lines 27 to 30
if (watch.length < 20)
setValue('triggerAndDiscussion.discussionWhitelist', [...discussionWhitelist, member], {
shouldValidate: true,
})
Copy link
Collaborator

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))
Copy link
Collaborator

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.

Suggested change
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)
Copy link
Contributor

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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused imports:

Suggested change
import { BN_ZERO } from '@/common/constants'

Comment on lines 14 to 15
import { Conditions } from '../../../bounty/modals/AddBountyModal/helpers'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused imports:

Suggested change
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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TooltipDefault import is not used, can we remove this one?
image

Suggested change
import { Tooltip, TooltipDefault } from '@/common/components/Tooltip'
import { Tooltip } from '@/common/components/Tooltip'

Copy link
Contributor

@oleksanderkorn oleksanderkorn left a 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?

@chrlschwb chrlschwb requested a review from freakstatic October 20, 2023 01:08
@chrlschwb chrlschwb closed this Dec 7, 2023
@chrlschwb chrlschwb force-pushed the fix/2491-maxWhiteListSize branch from 255c533 to 57d03ba Compare December 7, 2023 13:25
@chrlschwb chrlschwb deleted the fix/2491-maxWhiteListSize branch December 7, 2023 13:31
@chrlschwb chrlschwb restored the fix/2491-maxWhiteListSize branch December 7, 2023 13:31
@chrlschwb chrlschwb deleted the fix/2491-maxWhiteListSize branch December 7, 2023 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builders-wg-code-review community-dev issue suitable for community-dev pipeline
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants