Prevent deleting banned accounts

This commit is contained in:
rubenwardy 2023-08-10 16:31:16 +01:00
parent a1eac9959e
commit 32a305c9d8

@ -324,7 +324,9 @@ class User(db.Model, UserMixin):
def can_delete(self): def can_delete(self):
from app.models import ForumTopic from app.models import ForumTopic
return self.packages.count() == 0 and ForumTopic.query.filter_by(author=self).count() == 0 return self.packages.count() == 0 and \
ForumTopic.query.filter_by(author=self).count() == 0 and \
self.rank != UserRank.BANNED
class UserEmailVerification(db.Model): class UserEmailVerification(db.Model):