fix: show menu buttons for limited (traffic exhausted) subscriptions
When Remnawave webhook set subscription status to 'limited' (traffic exhausted), the main menu hid ALL buttons (connect, subscription, buy traffic) because is_active returns False for non-'active' status. Now 'limited' is treated as active for UI purposes — the subscription is not expired, just traffic-exhausted. Users can see the "Buy traffic" button precisely when they need it most.
This commit is contained in:
@@ -344,8 +344,9 @@ def _calculate_subscription_flags(subscription):
|
||||
return False, False
|
||||
|
||||
actual_status = getattr(subscription, 'actual_status', None)
|
||||
has_active_subscription = actual_status in {'active', 'trial'}
|
||||
subscription_is_active = bool(getattr(subscription, 'is_active', False))
|
||||
# 'limited' subscriptions are still active (traffic exhausted, but subscription not expired)
|
||||
has_active_subscription = actual_status in {'active', 'trial', 'limited'}
|
||||
subscription_is_active = bool(getattr(subscription, 'is_active', False)) or actual_status == 'limited'
|
||||
|
||||
return has_active_subscription, subscription_is_active
|
||||
|
||||
|
||||
Reference in New Issue
Block a user