No archive or pro for 2k+.

This commit is contained in:
Samuel Clay 2023-07-20 22:15:25 -04:00
parent 5731816ca1
commit 2418d2fc6e

View file

@ -283,6 +283,13 @@ class Profile(models.Model):
def activate_archive(self, never_expire=False):
UserSubscription.schedule_fetch_archive_feeds_for_user(self.user.pk)
subs = UserSubscription.objects.filter(user=self.user)
if subs.count() > 2000:
logging.user(self.user, "~FR~SK~FW~SBWARNING! ~FR%s subscriptions~SN!" % (subs.count()))
mail_admins(f"WARNING! {self.user.username} has {subs.count()} subscriptions",
f"{self.user.username} has {subs.count()} subscriptions and just upgraded to archive. They'll need a refund: {self.user.profile.paypal_sub_id} {self.user.profile.stripe_id} {self.user.email}")
return False
was_premium = self.is_premium
was_archive = self.is_archive
was_pro = self.is_pro
@ -293,7 +300,6 @@ class Profile(models.Model):
self.user.save()
# Only auto-enable every feed if a free user is moving to premium
subs = UserSubscription.objects.filter(user=self.user)
if not was_premium:
for sub in subs:
if sub.active: continue
@ -331,6 +337,13 @@ class Profile(models.Model):
EmailNewPremiumPro.delay(user_id=self.user.pk)
subs = UserSubscription.objects.filter(user=self.user)
if subs.count() > 2000:
logging.user(self.user, "~FR~SK~FW~SBWARNING! ~FR%s subscriptions~SN!" % (subs.count()))
mail_admins(f"WARNING! {self.user.username} has {subs.count()} subscriptions",
f"{self.user.username} has {subs.count()} subscriptions and just upgraded to pro. They'll need a refund: {self.user.profile.paypal_sub_id} {self.user.profile.stripe_id} {self.user.email}")
return False
was_premium = self.is_premium
was_archive = self.is_archive
was_pro = self.is_pro
@ -342,7 +355,6 @@ class Profile(models.Model):
self.user.save()
# Only auto-enable every feed if a free user is moving to premium
subs = UserSubscription.objects.filter(user=self.user)
if not was_premium:
for sub in subs:
if sub.active: continue