diff --git a/app/dashboard/views/coupon.py b/app/dashboard/views/coupon.py index 0e17468e..111a8ae9 100644 --- a/app/dashboard/views/coupon.py +++ b/app/dashboard/views/coupon.py @@ -23,7 +23,7 @@ def coupon_route(): return redirect(url_for("dashboard.index")) # handle case user already has an active subscription via another channel (Paddle, Apple, etc) - if current_user._lifetime_or_active_subscription(): + if current_user.lifetime_or_active_subscription(): manual_sub: ManualSubscription = ManualSubscription.get_by( user_id=current_user.id ) diff --git a/app/models.py b/app/models.py index a925a459..f2a0758c 100644 --- a/app/models.py +++ b/app/models.py @@ -386,7 +386,7 @@ class User(db.Model, ModelMixin, UserMixin, PasswordOracle): return user - def _lifetime_or_active_subscription(self) -> bool: + def lifetime_or_active_subscription(self) -> bool: """True if user has lifetime licence or active subscription""" if self.lifetime: return True @@ -435,7 +435,7 @@ class User(db.Model, ModelMixin, UserMixin, PasswordOracle): def in_trial(self): """return True if user does not have lifetime licence or an active subscription AND is in trial period""" - if self._lifetime_or_active_subscription(): + if self.lifetime_or_active_subscription(): return False if self.trial_end and arrow.now() < self.trial_end: @@ -444,7 +444,7 @@ class User(db.Model, ModelMixin, UserMixin, PasswordOracle): return False def should_show_upgrade_button(self): - if self._lifetime_or_active_subscription(): + if self.lifetime_or_active_subscription(): # user who has canceled can also re-subscribe sub: Subscription = self.get_subscription() if sub and sub.cancelled: @@ -490,7 +490,7 @@ class User(db.Model, ModelMixin, UserMixin, PasswordOracle): - in trial period or - active subscription """ - if self._lifetime_or_active_subscription(): + if self.lifetime_or_active_subscription(): return True if self.trial_end and arrow.now() < self.trial_end: @@ -582,7 +582,7 @@ class User(db.Model, ModelMixin, UserMixin, PasswordOracle): Whether user can create a new alias. User can't create a new alias if - has more than 15 aliases in the free plan, *even in the free trial* """ - if self._lifetime_or_active_subscription(): + if self.lifetime_or_active_subscription(): return True else: return Alias.filter_by(user_id=self.id).count() < MAX_NB_EMAIL_FREE_PLAN