mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 00:48:32 +01:00
make sure to set user_id when creating EmailLog
This commit is contained in:
parent
9ee8245760
commit
45ea72a997
2 changed files with 8 additions and 6 deletions
|
@ -316,7 +316,7 @@ def handle_forward(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> str:
|
|||
msg = prepare_pgp_message(msg, mailbox.pgp_finger_print)
|
||||
|
||||
contact = get_or_create_contact(msg["From"], alias)
|
||||
forward_log = EmailLog.create(contact_id=contact.id)
|
||||
forward_log = EmailLog.create(contact_id=contact.id, user_id=contact.user_id)
|
||||
|
||||
if alias.enabled:
|
||||
# add custom header
|
||||
|
@ -517,7 +517,7 @@ def handle_reply(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> str:
|
|||
envelope.rcpt_options,
|
||||
)
|
||||
|
||||
EmailLog.create(contact_id=contact.id, is_reply=True)
|
||||
EmailLog.create(contact_id=contact.id, is_reply=True, user_id=contact.user_id)
|
||||
db.session.commit()
|
||||
|
||||
return "250 Message accepted for delivery"
|
||||
|
@ -527,7 +527,9 @@ def handle_bounce(
|
|||
contact: Contact, alias: Alias, msg: Message, user: User, mailbox_email: str
|
||||
):
|
||||
address = alias.email
|
||||
fel: EmailLog = EmailLog.create(contact_id=contact.id, bounced=True)
|
||||
fel: EmailLog = EmailLog.create(
|
||||
contact_id=contact.id, bounced=True, user_id=contact.user_id
|
||||
)
|
||||
db.session.commit()
|
||||
|
||||
nb_bounced = EmailLog.filter_by(contact_id=contact.id, bounced=True).count()
|
||||
|
|
|
@ -169,10 +169,10 @@ def test_alias_activities(flask_client):
|
|||
db.session.commit()
|
||||
|
||||
for _ in range(int(PAGE_LIMIT / 2)):
|
||||
EmailLog.create(contact_id=contact.id, is_reply=True)
|
||||
EmailLog.create(contact_id=contact.id, is_reply=True, user_id=contact.user_id)
|
||||
|
||||
for _ in range(int(PAGE_LIMIT / 2) + 2):
|
||||
EmailLog.create(contact_id=contact.id, blocked=True)
|
||||
EmailLog.create(contact_id=contact.id, blocked=True, user_id=contact.user_id)
|
||||
|
||||
r = flask_client.get(
|
||||
url_for("api.get_alias_activities", alias_id=alias.id, page_id=0),
|
||||
|
@ -241,7 +241,7 @@ def test_alias_contacts(flask_client):
|
|||
)
|
||||
db.session.commit()
|
||||
|
||||
EmailLog.create(contact_id=contact.id, is_reply=True)
|
||||
EmailLog.create(contact_id=contact.id, is_reply=True, user_id=contact.user_id)
|
||||
db.session.commit()
|
||||
|
||||
r = flask_client.get(
|
||||
|
|
Loading…
Reference in a new issue