1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-25 08:09:38 +02:00

Enhance onboarding logic to account for recent trial starts

- Added a check to determine if a trial was started within the last few seconds, allowing for the assumption that onboarding was just completed even if the onboarded_at timestamp appears blank momentarily. This improves the user experience during onboarding transitions.
This commit is contained in:
Josh Pigford 2025-05-01 17:14:59 -05:00
parent 38b6e30bea
commit 17fa5413f6

View file

@ -18,7 +18,11 @@ module Onboardable
return unless Current.user
return unless redirectable_path?(request.path)
if Current.user.onboarded_at.blank?
# Check if trial was started VERY recently (e.g., within the last few seconds)
# If so, assume onboarding was just completed in the previous request, even if onboarded_at appears blank momentarily.
trial_just_started = Current.family.trial_started_at.present? && Current.family.trial_started_at > 10.seconds.ago
if Current.user.onboarded_at.blank? && !trial_just_started
redirect_to onboarding_path
elsif !Current.family.subscribed? && !Current.family.trialing?
redirect_to upgrade_subscription_path