Skip to content

Commit

Permalink
do not show verify page if using semaphore user registry
Browse files Browse the repository at this point in the history
  • Loading branch information
yuetloo committed Apr 25, 2024
1 parent 4ee0e4f commit d5bf859
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 6 additions & 1 deletion vue-app/src/api/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export enum UserRegistryType {
SIMPLE = 'simple',
SNAPSHOT = 'snapshot',
MERKLE = 'merkle',
SEMAPHORE = 'semaphore',
}

if (!Object.values(UserRegistryType).includes(userRegistryType as UserRegistryType)) {
Expand Down Expand Up @@ -92,7 +93,11 @@ export const showComplianceRequirement = /^yes$/i.test(import.meta.env.VITE_SHOW

export const isBrightIdRequired = userRegistryType === 'brightid'
export const isOptimisticRecipientRegistry = recipientRegistryType === 'optimistic'
export const isUserRegistrationRequired = userRegistryType !== UserRegistryType.SIMPLE
export const isUserRegistrationRequired = [
UserRegistryType.BRIGHT_ID,
UserRegistryType.MERKLE,
UserRegistryType.SNAPSHOT,
].includes(userRegistryType)

// Try to get the next scheduled start date
const nextStartDate = import.meta.env.VITE_NEXT_ROUND_START_DATE
Expand Down
4 changes: 2 additions & 2 deletions vue-app/src/components/CallToActionCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import { computed } from 'vue'
import BrightIdWidget from '@/components/BrightIdWidget.vue'
import Links from '@/components/Links.vue'
import { userRegistryType, UserRegistryType, isBrightIdRequired } from '@/api/core'
import { isUserRegistrationRequired, isBrightIdRequired } from '@/api/core'
import { useAppStore, useUserStore } from '@/stores'
import { storeToRefs } from 'pinia'
Expand All @@ -69,7 +69,7 @@ const hasStartedVerification = computed(
)
const showUserVerification = computed(() => {
return (
userRegistryType !== UserRegistryType.SIMPLE &&
isUserRegistrationRequired &&
currentRound.value &&
currentUser.value?.isRegistered !== undefined &&
!currentUser.value.isRegistered
Expand Down
6 changes: 2 additions & 4 deletions vue-app/src/components/Cart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ import CartItems from '@/components/CartItems.vue'
import Links from '@/components/Links.vue'
import TimeLeft from '@/components/TimeLeft.vue'
import { MAX_CONTRIBUTION_AMOUNT, MAX_CART_SIZE, type CartItem, isContributionAmountValid } from '@/api/contributions'
import { userRegistryType, UserRegistryType, operator } from '@/api/core'
import { userRegistryType, UserRegistryType, operator, isUserRegistrationRequired } from '@/api/core'
import { RoundStatus } from '@/api/round'
import { formatAmount as _formatAmount } from '@/utils/amounts'
import FundsNeededWarning from '@/components/FundsNeededWarning.vue'
Expand Down Expand Up @@ -477,9 +477,7 @@ const isBrightIdRequired = computed(
() => userRegistryType === UserRegistryType.BRIGHT_ID && !currentUser.value?.isRegistered,
)
const isRegistrationRequired = computed(
() => userRegistryType !== UserRegistryType.SIMPLE && !currentUser.value?.isRegistered,
)
const isRegistrationRequired = computed(() => isUserRegistrationRequired && !currentUser.value?.isRegistered)
const errorMessage = computed<string | null>(() => {
if (isMessageLimitReached.value) return t('dynamic.cart.error.reached_contribution_limit')
Expand Down

0 comments on commit d5bf859

Please sign in to comment.