refactor
This commit is contained in:
parent
e7c473c943
commit
33bd7dbcd6
|
@ -217,16 +217,17 @@ def delete_alias(alias: Alias, user: User):
|
||||||
email=alias.email, domain_id=alias.custom_domain_id
|
email=alias.email, domain_id=alias.custom_domain_id
|
||||||
):
|
):
|
||||||
LOG.d("add %s to domain %s trash", alias, alias.custom_domain_id)
|
LOG.d("add %s to domain %s trash", alias, alias.custom_domain_id)
|
||||||
Session.add(
|
DomainDeletedAlias.create(
|
||||||
DomainDeletedAlias(
|
user_id=user.id,
|
||||||
user_id=user.id, email=alias.email, domain_id=alias.custom_domain_id
|
email=alias.email,
|
||||||
)
|
domain_id=alias.custom_domain_id,
|
||||||
|
commit=True,
|
||||||
)
|
)
|
||||||
Session.commit()
|
|
||||||
else:
|
else:
|
||||||
if not DeletedAlias.get_by(email=alias.email):
|
if not DeletedAlias.get_by(email=alias.email):
|
||||||
LOG.d("add %s to global trash", alias)
|
LOG.d("add %s to global trash", alias)
|
||||||
Session.add(DeletedAlias(email=alias.email))
|
DeletedAlias.create(email=alias.email, commit=True)
|
||||||
Session.commit()
|
Session.commit()
|
||||||
|
|
||||||
LOG.i("delete alias %s", alias)
|
LOG.i("delete alias %s", alias)
|
||||||
|
|
Loading…
Reference in a new issue