make sure to set user_id when creating contact

This commit is contained in:
Son NK 2020-03-20 09:54:38 +01:00
parent abd2278c24
commit 6e54b4fed8
4 changed files with 6 additions and 0 deletions

View file

@ -320,6 +320,7 @@ def create_contact_route(alias_id):
return jsonify(error="Contact already added"), 409
contact = Contact.create(
user_id=alias.user_id,
alias_id=alias.id,
website_email=website_email,
website_from=contact_email,

View file

@ -87,6 +87,7 @@ def alias_contact_manager(alias_id, contact_id=None):
)
contact = Contact.create(
user_id=alias.user_id,
alias_id=alias.id,
website_email=website_email,
website_from=contact_email,

View file

@ -236,6 +236,7 @@ def get_or_create_contact(website_from_header: str, alias: Alias) -> Contact:
reply_email = f"reply+{random_string(30)}@{EMAIL_DOMAIN}"
contact = Contact.create(
user_id=alias.user_id,
alias_id=alias.id,
website_email=website_email,
website_from=website_from_header,

View file

@ -164,6 +164,7 @@ def test_alias_activities(flask_client):
website_email="marketing@example.com",
reply_email="reply@a.b",
alias_id=alias.id,
user_id=alias.user_id,
)
db.session.commit()
@ -236,6 +237,7 @@ def test_alias_contacts(flask_client):
website_email=f"marketing-{i}@example.com",
reply_email=f"reply-{i}@a.b",
alias_id=alias.id,
user_id=alias.user_id,
)
db.session.commit()
@ -318,6 +320,7 @@ def test_delete_contact(flask_client):
alias_id=alias.id,
website_email="contact@example.com",
reply_email="reply+random@sl.io",
user_id=alias.user_id,
)
db.session.commit()