feat: add TRIAL_DISABLED_FOR setting to disable trial by user type

New setting allows granular control over trial availability:
- none: trial available for all (default)
- email: trial disabled for email users
- telegram: trial disabled for telegram users
- all: trial disabled for everyone

Enforced in bot handlers, cabinet API, and miniapp routes.
Automatically appears in admin panel as dropdown via CHOICES.
This commit is contained in:
Fringg
2026-02-07 00:19:25 +03:00
parent 1ffb8a5b85
commit c4794db1dd
5 changed files with 58 additions and 0 deletions
+3
View File
@@ -3047,6 +3047,9 @@ def _is_trial_available_for_user(user: User) -> bool:
if settings.TRIAL_DURATION_DAYS <= 0:
return False
if settings.is_trial_disabled_for_user(getattr(user, 'auth_type', 'telegram')):
return False
if getattr(user, 'has_had_paid_subscription', False):
return False