fix: defer expiry reminders for trial and bonus subscriptions
Trial and registration/referral-bonus subscriptions usually last only a few days, so the multi-day ending-soon reminders fired almost the moment they were granted and needlessly alarmed newcomers. Track this with a new subscription flag (suppress_early_expiry_notifications, migration 0035): trial activation, referral welcome bonus and inviter bonus grants set it, while a real paid purchase clears it on upsert. While set, the notification worker skips the day-before stages but still sends the hours-before reminder and the expiry/after-expiry notices, so users are warned shortly before access ends. Once they pay for a full subscription the complete reminder spectrum resumes.
This commit is contained in:
@@ -1143,6 +1143,18 @@ def _migration_0034_add_legacy_import_compatibility(connection: Connection) -> N
|
||||
)
|
||||
|
||||
|
||||
def _migration_0035_add_subscription_promo_expiry_flag(connection: Connection) -> None:
|
||||
inspector = inspect(connection)
|
||||
columns: Set[str] = {col["name"] for col in inspector.get_columns("subscriptions")}
|
||||
if "suppress_early_expiry_notifications" not in columns:
|
||||
connection.execute(
|
||||
text(
|
||||
"ALTER TABLE subscriptions ADD COLUMN suppress_early_expiry_notifications "
|
||||
"BOOLEAN NOT NULL DEFAULT FALSE"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
MIGRATIONS: List[Migration] = [
|
||||
Migration(
|
||||
id="0001_add_channel_subscription_fields",
|
||||
@@ -1325,6 +1337,11 @@ MIGRATIONS: List[Migration] = [
|
||||
description="Store legacy import mappings and referral codes for source-bot migrations",
|
||||
upgrade=_migration_0034_add_legacy_import_compatibility,
|
||||
),
|
||||
Migration(
|
||||
id="0035_add_subscription_promo_expiry_flag",
|
||||
description="Suppress multi-day expiry reminders for trial and bonus subscriptions",
|
||||
upgrade=_migration_0035_add_subscription_promo_expiry_flag,
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user