revert: userid storing on deleted alias (#2305)

This commit is contained in:
Carlos Quintana 2024-11-06 12:24:54 +01:00 committed by GitHub
parent 31c8a766be
commit a8ca2d3d37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 6 deletions

View file

@ -362,9 +362,7 @@ def delete_alias(
)
else:
if not DeletedAlias.get_by(email=alias.email):
deleted_alias = DeletedAlias(
email=alias.email, reason=reason, user_id=user.id
)
deleted_alias = DeletedAlias(email=alias.email, reason=reason)
Session.add(deleted_alias)
Session.commit()
LOG.i(f"Moving {alias} to global trash {deleted_alias}")

View file

@ -31,9 +31,7 @@ def test_delete_alias(flask_client):
delete_alias(alias, user)
assert Alias.get_by(email=alias.email) is None
deleted_alias = DeletedAlias.get_by(email=alias.email)
assert deleted_alias is not None
assert deleted_alias.user_id == user.id
assert DeletedAlias.get_by(email=alias.email)
def test_delete_alias_already_in_trash(flask_client):