Skip to content

Commit c6eabec

Browse files
committed
fix: remove redundant free-tier guard from purchaseCredits
The only caller (TopUpCreditsDialogContentLegacy) is already gated by showTopUpCreditsDialog, making the bottom-layer check unreachable. Also adds a doc comment to HAS_ACCOUNT_KEY explaining its purpose.
1 parent 2f7f330 commit c6eabec

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

src/composables/auth/useFirebaseAuthActions.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { ref } from 'vue'
44

55
import { useBillingContext } from '@/composables/billing/useBillingContext'
66
import { useErrorHandling } from '@/composables/useErrorHandling'
7-
import { useSubscription } from '@/platform/cloud/subscription/composables/useSubscription'
87
import type { ErrorRecoveryStrategy } from '@/composables/useErrorHandling'
98
import { t } from '@/i18n'
109
import { isCloud } from '@/platform/distribution/types'
@@ -99,16 +98,6 @@ export const useFirebaseAuthActions = () => {
9998
const { isActiveSubscription } = useBillingContext()
10099
if (!isActiveSubscription.value) return
101100

102-
// Defense-in-depth: showTopUpCreditsDialog also gates free-tier users,
103-
// but purchaseCredits can be called directly from other entry points.
104-
const { isFreeTier } = useSubscription()
105-
if (isFreeTier.value) {
106-
await useDialogService().showSubscriptionRequiredDialog({
107-
reason: 'top_up_blocked'
108-
})
109-
return
110-
}
111-
112101
const response = await authStore.initiateCreditPurchase({
113102
amount_micros: usdToMicros(amount),
114103
currency: 'usd'

src/stores/firebaseAuthStore.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import type { AuthHeader } from '@/types/authTypes'
3131
import type { operations } from '@/types/comfyRegistryTypes'
3232
import { useFeatureFlags } from '@/composables/useFeatureFlags'
3333

34+
/** Set after first login; used to detect returning users so the sign-in flow can skip the free-tier badge. */
3435
export const HAS_ACCOUNT_KEY = 'comfy:hasAccount'
3536

3637
type CreditPurchaseResponse =

0 commit comments

Comments
 (0)