show cancel status in "Current plan" section (#1114)
* show cancel status in "Current plan" section * do not show upgrade button for canceled paddle sub
This commit is contained in:
parent
dd0598a4dd
commit
89062edc06
|
@ -370,6 +370,7 @@ def setting():
|
|||
manual_sub = ManualSubscription.get_by(user_id=current_user.id)
|
||||
apple_sub = AppleSubscription.get_by(user_id=current_user.id)
|
||||
coinbase_sub = CoinbaseSubscription.get_by(user_id=current_user.id)
|
||||
paddle_sub = current_user.get_paddle_subscription()
|
||||
partner_sub = None
|
||||
partner_name = None
|
||||
|
||||
|
@ -393,6 +394,7 @@ def setting():
|
|||
partner_sub=partner_sub,
|
||||
partner_name=partner_name,
|
||||
apple_sub=apple_sub,
|
||||
paddle_sub=paddle_sub,
|
||||
coinbase_sub=coinbase_sub,
|
||||
FIRST_ALIAS_DOMAIN=FIRST_ALIAS_DOMAIN,
|
||||
ALIAS_RAND_SUFFIX_LENGTH=ALIAS_RANDOM_SUFFIX_LENGTH,
|
||||
|
|
|
@ -675,15 +675,7 @@ class User(Base, ModelMixin, UserMixin, PasswordOracle):
|
|||
return False
|
||||
|
||||
def should_show_upgrade_button(self):
|
||||
if self.lifetime:
|
||||
return False
|
||||
|
||||
if self.lifetime_or_active_subscription():
|
||||
# user who has canceled can also re-subscribe
|
||||
sub: Subscription = self.get_paddle_subscription()
|
||||
if sub and sub.cancelled:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
return True
|
||||
|
|
|
@ -27,9 +27,10 @@
|
|||
{% if current_user.lifetime %}
|
||||
You have lifetime access to the Premium plan.
|
||||
{% elif current_user.lifetime_or_active_subscription() %}
|
||||
{% if current_user.get_paddle_subscription() %}
|
||||
{% if paddle_sub %}
|
||||
<div>
|
||||
{{ current_user.get_paddle_subscription().plan_name() }} plan subscribed via Paddle.
|
||||
{% if paddle_sub.cancelled %}(Cancelled){% endif %}
|
||||
{{ paddle_sub.plan_name() }} plan subscribed via Paddle.
|
||||
<a href="{{ url_for('dashboard.billing') }}">
|
||||
Manage Subscription ➡
|
||||
</a>
|
||||
|
|
Loading…
Reference in New Issue