no need to move alias to global trash when a domain is deleted

This commit is contained in:
Son NK 2020-05-20 10:16:55 +02:00
parent 300ece2440
commit 2217805d8c
1 changed files with 0 additions and 14 deletions

View File

@ -1170,20 +1170,6 @@ class CustomDomain(db.Model, ModelMixin):
user = db.relationship(User)
@classmethod
def delete(cls, obj_id):
# Put all aliases belonging to this domain to global trash
try:
for alias in Alias.query.filter_by(custom_domain_id=obj_id):
DeletedAlias.create(email=alias.email)
db.session.commit()
except IntegrityError:
LOG.error("Some aliases have been added before to DeletedAlias")
db.session.rollback()
cls.query.filter(cls.id == obj_id).delete()
db.session.commit()
def nb_alias(self):
return Alias.filter_by(custom_domain_id=self.id).count()